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 |
AX25_Transmit.ino (2314B)
1 /* 2 RadioLib AX.25 Transmit Example 3 4 This example sends AX.25 messages using 5 SX1278's FSK modem. 6 7 Other modules that can be used for AX.25: 8 - SX127x/RFM9x 9 - RF69 10 - SX1231 11 - CC1101 12 - SX126x 13 - nRF24 14 - Si443x/RFM2x 15 16 For default module settings, see the wiki page 17 https://github.com/jgromes/RadioLib/wiki/Default-configuration 18 19 For full API reference, see the GitHub Pages 20 https://jgromes.github.io/RadioLib/ 21 */ 22 23 // include the library 24 #include <RadioLib.h> 25 26 // SX1278 has the following connections: 27 // NSS pin: 10 28 // DIO0 pin: 2 29 // RESET pin: 9 30 // DIO1 pin: 3 31 SX1278 radio = new Module(10, 2, 9, 3); 32 33 // or using RadioShield 34 // https://github.com/jgromes/RadioShield 35 //SX1278 radio = RadioShield.ModuleA; 36 37 // create AX.25 client instance using the FSK module 38 AX25Client ax25(&radio); 39 40 void setup() { 41 Serial.begin(9600); 42 43 // initialize SX1278 44 Serial.print(F("[SX1278] Initializing ... ")); 45 // carrier frequency: 434.0 MHz 46 // bit rate: 1.2 kbps (1200 baud 2-FSK AX.25) 47 int state = radio.beginFSK(434.0, 1.2); 48 49 // when using one of the non-LoRa modules for AX.25 50 // (RF69, CC1101,, Si4432 etc.), use the basic begin() method 51 // int state = radio.begin(); 52 53 if(state == RADIOLIB_ERR_NONE) { 54 Serial.println(F("success!")); 55 } else { 56 Serial.print(F("failed, code ")); 57 Serial.println(state); 58 while(true); 59 } 60 61 // initialize AX.25 client 62 Serial.print(F("[AX.25] Initializing ... ")); 63 // source station callsign: "N7LEM" 64 // source station SSID: 0 65 // preamble length: 8 bytes 66 state = ax25.begin("N7LEM"); 67 if(state == RADIOLIB_ERR_NONE) { 68 Serial.println(F("success!")); 69 } else { 70 Serial.print(F("failed, code ")); 71 Serial.println(state); 72 while(true); 73 } 74 } 75 76 void loop() { 77 // send AX.25 unnumbered information frame 78 Serial.print(F("[AX.25] Sending UI frame ... ")); 79 // destination station callsign: "NJ7P" 80 // destination station SSID: 0 81 int state = ax25.transmit("Hello World!", "NJ7P"); 82 if (state == RADIOLIB_ERR_NONE) { 83 // the packet was successfully transmitted 84 Serial.println(F("success!")); 85 86 } else { 87 // some error occurred 88 Serial.print(F("failed, code ")); 89 Serial.println(state); 90 91 } 92 93 delay(1000); 94 }