acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
APRS_MicE.ino (2860B)
1 /* 2 RadioLib APRS Mic-E Example 3 4 This example sends APRS position reports 5 encoded in the Mic-E format using SX1278's 6 FSK modem. The data is modulated as AFSK 7 at 1200 baud using Bell 202 tones. 8 9 DO NOT transmit in APRS bands unless 10 you have a ham radio license! 11 12 Other modules that can be used for APRS: 13 - SX127x/RFM9x 14 - RF69 15 - SX1231 16 - CC1101 17 - nRF24 18 - Si443x/RFM2x 19 20 For default module settings, see the wiki page 21 https://github.com/jgromes/RadioLib/wiki/Default-configuration 22 23 For full API reference, see the GitHub Pages 24 https://jgromes.github.io/RadioLib/ 25 */ 26 27 // include the library 28 #include <RadioLib.h> 29 30 // SX1278 has the following connections: 31 // NSS pin: 10 32 // DIO0 pin: 2 33 // RESET pin: 9 34 // DIO1 pin: 3 35 SX1278 radio = new Module(10, 2, 9, 3); 36 37 // or using RadioShield 38 // https://github.com/jgromes/RadioShield 39 //SX1278 radio = RadioShield.ModuleA; 40 41 // create AFSK client instance using the FSK module 42 // pin 5 is connected to SX1278 DIO2 43 AFSKClient audio(&radio, 5); 44 45 // create AX.25 client instance using the AFSK instance 46 AX25Client ax25(&audio); 47 48 // create APRS client isntance using the AX.25 client 49 APRSClient aprs(&ax25); 50 51 void setup() { 52 Serial.begin(9600); 53 54 // initialize SX1278 55 // NOTE: moved to ISM band on purpose 56 // DO NOT transmit in APRS bands without ham radio license! 57 Serial.print(F("[SX1278] Initializing ... ")); 58 int state = radio.beginFSK(); 59 60 // when using one of the non-LoRa modules for AX.25 61 // (RF69, CC1101, Si4432 etc.), use the basic begin() method 62 // int state = radio.begin(); 63 64 if(state == RADIOLIB_ERR_NONE) { 65 Serial.println(F("success!")); 66 } else { 67 Serial.print(F("failed, code ")); 68 Serial.println(state); 69 while(true); 70 } 71 72 // initialize AX.25 client 73 Serial.print(F("[AX.25] Initializing ... ")); 74 // source station callsign: "N7LEM" 75 // source station SSID: 0 76 // preamble length: 8 bytes 77 state = ax25.begin("N7LEM"); 78 if(state == RADIOLIB_ERR_NONE) { 79 Serial.println(F("success!")); 80 } else { 81 Serial.print(F("failed, code ")); 82 Serial.println(state); 83 while(true); 84 } 85 86 // initialize APRS client 87 Serial.print(F("[APRS] Initializing ... ")); 88 // symbol: '>' (car) 89 state = aprs.begin('>'); 90 if(state == RADIOLIB_ERR_NONE) { 91 Serial.println(F("success!")); 92 } else { 93 Serial.print(F("failed, code ")); 94 Serial.println(state); 95 while(true); 96 } 97 } 98 99 void loop() { 100 Serial.print(F("[APRS] Sending Mic-E position ... ")); 101 int state = aprs.sendMicE(49.1945, 16.6000, 120, 10, RADIOLIB_APRS_MIC_E_TYPE_EN_ROUTE); 102 if(state == RADIOLIB_ERR_NONE) { 103 Serial.println(F("success!")); 104 } else { 105 Serial.print(F("failed, code ")); 106 Serial.println(state); 107 } 108 109 // wait one minute before transmitting again 110 delay(60000); 111 }