Fixed FoxHunt example. Verified working with current library and hardware v09
This commit is contained in:
parent
8c90a134ad
commit
12c9cdf3d9
|
@ -6,9 +6,9 @@
|
||||||
#define RESET_PIN A3
|
#define RESET_PIN A3
|
||||||
#define SWITCH_PIN 2
|
#define SWITCH_PIN 2
|
||||||
|
|
||||||
// transmit for 1 minute, every 10 minutes
|
// In milliseconds
|
||||||
|
#define TRANSMITLENGTH 60000
|
||||||
#define TRANSMITLENGTH 1
|
// In minutes
|
||||||
#define INTERVAL 10
|
#define INTERVAL 10
|
||||||
#define RANDOMCHANCE 3
|
#define RANDOMCHANCE 3
|
||||||
|
|
||||||
|
@ -27,23 +27,23 @@ void setup() {
|
||||||
digitalWrite(RESET_PIN, HIGH);
|
digitalWrite(RESET_PIN, HIGH);
|
||||||
|
|
||||||
radio.initialize();
|
radio.initialize();
|
||||||
radio.frequency(145510);
|
radio.setRfPower(0);
|
||||||
|
radio.frequency(438000);
|
||||||
radio.setModeReceive();
|
radio.setModeReceive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
waitMinute(INTERVAL + random(0,RANDOMCHANCE)); // wait before transmitting, randomly up to 3 minutes later
|
|
||||||
if(radio.waitForChannel(30000,2000, -90)) { // wait for a clear channel, abort after 30 seconds, wait 2 seconds of dead air for breakers
|
if(radio.waitForChannel(30000,2000, -90)) { // wait for a clear channel, abort after 30 seconds, wait 2 seconds of dead air for breakers
|
||||||
radio.setModeTransmit(); // turn on transmit mode
|
radio.setModeTransmit(); // turn on transmit mode
|
||||||
tone(1000,11,TRANSMITLENGTH * 60 * 1000); // play a long solid tone
|
tone(PWM_PIN, 1000, TRANSMITLENGTH); // play a long solid tone
|
||||||
radio.morseOut("1ZZ9ZZ/B FOXHUNT"); // identify the fox hunt transmitter
|
delay(TRANSMITLENGTH);
|
||||||
|
radio.morseOut(" 1ZZ9ZZ/B FOXHUNT"); // identify the fox hunt transmitter
|
||||||
radio.setModeReceive(); // turn off the transmit mode
|
radio.setModeReceive(); // turn off the transmit mode
|
||||||
}
|
}
|
||||||
|
waitMinute(INTERVAL + random(0,RANDOMCHANCE)); // wait before transmitting, randomly
|
||||||
}
|
}
|
||||||
|
|
||||||
// a function so we can wait by minutes
|
// a function so we can wait by minutes
|
||||||
|
void waitMinute(unsigned long period) {
|
||||||
void waitMinute(int period) {
|
|
||||||
delay(period * 60 * 1000);
|
delay(period * 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue