-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
351 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
RadioLib APRS Mic-E Example | ||
This example sends APRS position reports | ||
encoded in the Mic-E format using SX1278's | ||
FSK modem. The data is modulated as AFSK | ||
at 1200 baud using Bell 202 tones. | ||
DO NOT transmit in APRS bands unless | ||
you have a ham radio license! | ||
Other modules that can be used for APRS: | ||
- SX127x/RFM9x | ||
- RF69 | ||
- SX1231 | ||
- CC1101 | ||
- nRF24 | ||
- Si443x/RFM2x | ||
For default module settings, see the wiki page | ||
https://github.com/jgromes/RadioLib/wiki/Default-configuration | ||
For full API reference, see the GitHub Pages | ||
https://jgromes.github.io/RadioLib/ | ||
*/ | ||
|
||
// include the library | ||
#include <RadioLib.h> | ||
|
||
// SX1278 has the following connections: | ||
// NSS pin: 10 | ||
// DIO0 pin: 2 | ||
// RESET pin: 9 | ||
// DIO1 pin: 3 | ||
SX1278 radio = new Module(10, 2, 9, 3); | ||
|
||
// or using RadioShield | ||
// https://github.com/jgromes/RadioShield | ||
//SX1278 radio = RadioShield.ModuleA; | ||
|
||
// create AFSK client instance using the FSK module | ||
// pin 5 is connected to SX1278 DIO2 | ||
AFSKClient audio(&radio, 5); | ||
|
||
// create AX.25 client instance using the AFSK instance | ||
AX25Client ax25(&audio); | ||
|
||
// create APRS client isntance using the AX.25 client | ||
APRSClient aprs(&ax25); | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
|
||
// initialize SX1278 | ||
// NOTE: moved to ISM band on purpose | ||
// DO NOT transmit in APRS bands without ham radio license! | ||
Serial.print(F("[SX1278] Initializing ... ")); | ||
int state = radio.beginFSK(); | ||
|
||
// when using one of the non-LoRa modules for AX.25 | ||
// (RF69, CC1101, Si4432 etc.), use the basic begin() method | ||
// int state = radio.begin(); | ||
|
||
if(state == RADIOLIB_ERR_NONE) { | ||
Serial.println(F("success!")); | ||
} else { | ||
Serial.print(F("failed, code ")); | ||
Serial.println(state); | ||
while(true); | ||
} | ||
|
||
// initialize AX.25 client | ||
Serial.print(F("[AX.25] Initializing ... ")); | ||
// source station callsign: "N7LEM" | ||
// source station SSID: 0 | ||
// preamble length: 8 bytes | ||
state = ax25.begin("N7LEM"); | ||
if(state == RADIOLIB_ERR_NONE) { | ||
Serial.println(F("success!")); | ||
} else { | ||
Serial.print(F("failed, code ")); | ||
Serial.println(state); | ||
while(true); | ||
} | ||
|
||
// initialize APRS client | ||
Serial.print(F("[APRS] Initializing ... ")); | ||
// symbol: '>' (car) | ||
state = aprs.begin('>'); | ||
if(state == RADIOLIB_ERR_NONE) { | ||
Serial.println(F("success!")); | ||
} else { | ||
Serial.print(F("failed, code ")); | ||
Serial.println(state); | ||
while(true); | ||
} | ||
} | ||
|
||
void loop() { | ||
Serial.print(F("[APRS] Sending Mic-E position ... ")); | ||
int state = aprs.sendMicE(49.1945, 16.6000, 120, 10, RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE); | ||
if(state == RADIOLIB_ERR_NONE) { | ||
Serial.println(F("success!")); | ||
} else { | ||
Serial.print(F("failed, code ")); | ||
Serial.println(state); | ||
} | ||
|
||
// wait one minute before transmitting again | ||
delay(60000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.