[RTTY] Updated example
This commit is contained in:
parent
70be6df935
commit
d157b478b5
1 changed files with 32 additions and 30 deletions
|
@ -25,75 +25,77 @@ void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// initialize SX1278
|
// initialize SX1278
|
||||||
Serial.print("[SX1278] Initializing ... ");
|
Serial.print(F("[SX1278] Initializing ... "));
|
||||||
// carrier frequency: 434.4 MHz
|
// carrier frequency: 434.0 MHz
|
||||||
// bit rate: 48.0 kbps
|
// bit rate: 48.0 kbps
|
||||||
// frequency deviation: 50.0 kHz
|
// frequency deviation: 50.0 kHz
|
||||||
// Rx bandwidth: 125.0 kHz
|
// Rx bandwidth: 125.0 kHz
|
||||||
// output power: 13 dBm
|
// output power: 13 dBm
|
||||||
// current limit: 100 mA
|
// current limit: 100 mA
|
||||||
// sync word: 0x2D 0x01
|
// sync word: 0x2D 0x01
|
||||||
int state = fsk.beginFSK(434.4);
|
int state = fsk.beginFSK();
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println("success!");
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print("failed, code ");
|
Serial.print(F("failed, code "));
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize RTTY client
|
// initialize RTTY client
|
||||||
Serial.print("[RTTY] Initializing ... ");
|
// NOTE: RTTY frequency shift MUST be divisible by 61 Hz!
|
||||||
state = rtty.begin(434.4, 183, 45);
|
Serial.print(F("[RTTY] Initializing ... "));
|
||||||
// low frequency: 434.4 MHz
|
// low frequency: 434.0 MHz
|
||||||
// frequency shift: 183 Hz (must be divisible by 61!)
|
// frequency shift: 183 Hz
|
||||||
// baud rate: 45 baud
|
// baud rate: 45 baud
|
||||||
// data bits: 8
|
// data bits: 8
|
||||||
// stop bits: 1
|
// stop bits: 1
|
||||||
|
state = rtty.begin(434, 183, 45);
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println("success!");
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
Serial.print("failed, code ");
|
Serial.print(F("failed, code "));
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.println("Sending RTTY data ... ");
|
Serial.println(F("Sending RTTY data ... "));
|
||||||
|
|
||||||
// send 500 ms high frequency beep
|
// send out idle condition for 500 ms
|
||||||
rtty.leadIn(500);
|
rtty.idle();
|
||||||
|
delay(500);
|
||||||
|
|
||||||
// RTTYClient supports all methods of the Serial class
|
// RTTYClient supports all methods of the Serial class
|
||||||
|
|
||||||
|
// Arduino String class
|
||||||
String aStr = "Arduino String";
|
String aStr = "Arduino String";
|
||||||
rtty.print(aStr);
|
|
||||||
rtty.println(aStr);
|
rtty.println(aStr);
|
||||||
|
|
||||||
const char cStr[] = "C-string";
|
// character array (C-string)
|
||||||
rtty.print(cStr);
|
rtty.println("C-string");
|
||||||
rtty.println(cStr);
|
|
||||||
|
|
||||||
char c = 'c';
|
// character
|
||||||
rtty.print(c);
|
rtty.println('c');
|
||||||
rtty.println(c);
|
|
||||||
|
|
||||||
byte b = 0xAA;
|
// byte
|
||||||
rtty.print(b, HEX);
|
// formatting DEC/HEX/OCT/BIN is supported for
|
||||||
rtty.println(b, HEX);
|
// any integer type (byte/int/long)
|
||||||
|
rtty.println(255, HEX);
|
||||||
|
|
||||||
|
// integer number
|
||||||
int i = 1000;
|
int i = 1000;
|
||||||
rtty.print(i);
|
|
||||||
rtty.println(i);
|
rtty.println(i);
|
||||||
|
|
||||||
float f = 3.1415;
|
// floating point number
|
||||||
rtty.print(f, 3);
|
float f = -3.1415;
|
||||||
rtty.println(f, 3);
|
rtty.println(f, 3);
|
||||||
|
|
||||||
// turn transmitter off
|
// turn transmitter off
|
||||||
fsk.standby();
|
fsk.standby();
|
||||||
|
|
||||||
Serial.println("done!");
|
Serial.println(F("done!"));
|
||||||
|
|
||||||
// wait for a second before transmitting again
|
// wait for a second before transmitting again
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
Loading…
Add table
Reference in a new issue