Merge pull request #37 from ip2k/master

Moving Blink def so it compiles on PlatformIO
This commit is contained in:
Felix Rusu 2016-03-08 11:14:51 -05:00
commit 2e84b5b2ce
1 changed files with 14 additions and 14 deletions

View File

@ -55,7 +55,7 @@ void setup() {
#endif #endif
radio.encrypt(ENCRYPTKEY); radio.encrypt(ENCRYPTKEY);
//radio.setFrequency(919000000); //set frequency to some custom frequency //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) //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 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 //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 #ifdef ENABLE_ATC
radio.enableAutoPower(-70); radio.enableAutoPower(-70);
#endif #endif
char buff[50]; char buff[50];
sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915); sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
Serial.println(buff); Serial.println(buff);
if (flash.initialize()) if (flash.initialize())
{ {
Serial.print("SPI Flash Init OK ... UniqueID (MAC): "); Serial.print("SPI Flash Init OK ... UniqueID (MAC): ");
@ -81,12 +81,20 @@ void setup() {
} }
else else
Serial.println("SPI Flash MEM not found (is chip soldered?)..."); Serial.println("SPI Flash MEM not found (is chip soldered?)...");
#ifdef ENABLE_ATC #ifdef ENABLE_ATC
Serial.println("RFM69_ATC Enabled (Auto Transmission Control)\n"); Serial.println("RFM69_ATC Enabled (Auto Transmission Control)\n");
#endif #endif
} }
void Blink(byte PIN, int DELAY_MS)
{
pinMode(PIN, OUTPUT);
digitalWrite(PIN,HIGH);
delay(DELAY_MS);
digitalWrite(PIN,LOW);
}
long lastPeriod = 0; long lastPeriod = 0;
void loop() { void loop() {
//process any serial input //process any serial input
@ -158,7 +166,7 @@ void loop() {
if (currPeriod != lastPeriod) if (currPeriod != lastPeriod)
{ {
lastPeriod=currPeriod; lastPeriod=currPeriod;
//send FLASH id //send FLASH id
if(sendSize==0) if(sendSize==0)
{ {
@ -176,7 +184,7 @@ void loop() {
Serial.print("]: "); Serial.print("]: ");
for(byte i = 0; i < sendSize; i++) for(byte i = 0; i < sendSize; i++)
Serial.print((char)payload[i]); Serial.print((char)payload[i]);
if (radio.sendWithRetry(GATEWAYID, payload, sendSize)) if (radio.sendWithRetry(GATEWAYID, payload, sendSize))
Serial.print(" ok!"); Serial.print(" ok!");
else Serial.print(" nothing..."); else Serial.print(" nothing...");
@ -186,11 +194,3 @@ void loop() {
Blink(LED,3); Blink(LED,3);
} }
} }
void Blink(byte PIN, int DELAY_MS)
{
pinMode(PIN, OUTPUT);
digitalWrite(PIN,HIGH);
delay(DELAY_MS);
digitalWrite(PIN,LOW);
}