2015-06-20 20:37:48 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Morse Code Beacon
|
|
|
|
|
|
|
|
Test beacon will transmit and wait 30 seconds.
|
|
|
|
Beacon will check to see if the channel is clear before it will transmit.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2015-06-20 21:00:39 +00:00
|
|
|
#include <HamShield.h>
|
2015-06-20 20:37:48 +00:00
|
|
|
#include <Wire.h>
|
|
|
|
|
2015-06-20 22:22:33 +00:00
|
|
|
HamShield radio;
|
2015-06-20 20:37:48 +00:00
|
|
|
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(9600);
|
|
|
|
Serial.println("starting up..");
|
|
|
|
Wire.begin();
|
2015-06-20 21:00:39 +00:00
|
|
|
|
2015-06-20 20:37:48 +00:00
|
|
|
Serial.print("Radio status: ");
|
|
|
|
int result = radio.testConnection();
|
|
|
|
Serial.println(result,DEC);
|
|
|
|
radio.initialize(); // setup radio
|
2015-06-22 17:54:44 +00:00
|
|
|
radio.frequency(446000); // set to 70 cm call frequency
|
2015-06-20 20:37:48 +00:00
|
|
|
Serial.println("Done with radio beacon setup.");
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2015-06-20 22:22:33 +00:00
|
|
|
if(radio.waitForChannel(30000,2000,-50)) { // wait up to 30 seconds for a clear channel, and then 2 seconds of empty channel
|
2015-06-20 21:00:39 +00:00
|
|
|
Serial.println("Signal is clear -- Transmitting");
|
|
|
|
radio.setModeTransmit(); // turn on the transmitter
|
|
|
|
radio.morseOut("1ZZ9ZZ/B CN87 ARDUINO HAMSHIELD");
|
|
|
|
radio.setModeReceive(); // turn off the transmitter (receive mode)
|
|
|
|
Serial.print("TX Off");
|
|
|
|
delay(30000);
|
|
|
|
} else {
|
2015-06-20 22:22:33 +00:00
|
|
|
Serial.print("The channel was busy. Waiting 10 seconds. RSSI: ");
|
|
|
|
Serial.println(radio.readRSSI());
|
2015-06-20 21:00:39 +00:00
|
|
|
delay(10000);
|
|
|
|
}
|
2015-06-20 20:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|