From 91a462cea40fc013d9d3f56b16afb7e086610b08 Mon Sep 17 00:00:00 2001 From: Sean Petrow Date: Mon, 7 Mar 2016 02:35:04 -0800 Subject: [PATCH] Moving Blink def so it compiles on PlatformIO --- Examples/Node/Node.ino | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Examples/Node/Node.ino b/Examples/Node/Node.ino index bc09055..72b84a4 100644 --- a/Examples/Node/Node.ino +++ b/Examples/Node/Node.ino @@ -55,7 +55,7 @@ void setup() { #endif radio.encrypt(ENCRYPTKEY); //radio.setFrequency(919000000); //set frequency to some custom frequency - + //Auto Transmission Control - dials down transmit power to save battery (-100 is the noise floor, -90 is still pretty good) //For indoor nodes that are pretty static and at pretty stable temperatures (like a MotionMote) -90dBm is quite safe //For more variable nodes that can expect to move or experience larger temp drifts a lower margin like -70 to -80 would probably be better @@ -63,11 +63,11 @@ void setup() { #ifdef ENABLE_ATC radio.enableAutoPower(-70); #endif - + char buff[50]; sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); Serial.println(buff); - + if (flash.initialize()) { Serial.print("SPI Flash Init OK ... UniqueID (MAC): "); @@ -81,12 +81,20 @@ void setup() { } else Serial.println("SPI Flash MEM not found (is chip soldered?)..."); - + #ifdef ENABLE_ATC Serial.println("RFM69_ATC Enabled (Auto Transmission Control)\n"); #endif } +void Blink(byte PIN, int DELAY_MS) +{ + pinMode(PIN, OUTPUT); + digitalWrite(PIN,HIGH); + delay(DELAY_MS); + digitalWrite(PIN,LOW); +} + long lastPeriod = 0; void loop() { //process any serial input @@ -158,7 +166,7 @@ void loop() { if (currPeriod != lastPeriod) { lastPeriod=currPeriod; - + //send FLASH id if(sendSize==0) { @@ -176,7 +184,7 @@ void loop() { Serial.print("]: "); for(byte i = 0; i < sendSize; i++) Serial.print((char)payload[i]); - + if (radio.sendWithRetry(GATEWAYID, payload, sendSize)) Serial.print(" ok!"); else Serial.print(" nothing..."); @@ -186,11 +194,3 @@ void loop() { Blink(LED,3); } } - -void Blink(byte PIN, int DELAY_MS) -{ - pinMode(PIN, OUTPUT); - digitalWrite(PIN,HIGH); - delay(DELAY_MS); - digitalWrite(PIN,LOW); -} \ No newline at end of file