From ccbd7ff7d0ff477d1286aba481e10f078cb3759d Mon Sep 17 00:00:00 2001 From: Felix Rusu Date: Tue, 12 Aug 2014 22:31:42 -0400 Subject: [PATCH] Updates & MEGA support --- .../WirelessProgramming_gateway.ino | 11 +++++++--- .../WirelessProgramming_node.ino | 22 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Examples/WirelessProgramming_gateway/WirelessProgramming_gateway.ino b/Examples/WirelessProgramming_gateway/WirelessProgramming_gateway.ino index f17d294..ab5faa8 100644 --- a/Examples/WirelessProgramming_gateway/WirelessProgramming_gateway.ino +++ b/Examples/WirelessProgramming_gateway/WirelessProgramming_gateway.ino @@ -24,19 +24,24 @@ #include #define NETWORKID 250 //what network this node is on -#define NODEID 5 //this node's ID, should be unique among nodes on this NETWORKID +#define NODEID 254 //this node's ID, should be unique among nodes on this NETWORKID //Match frequency to the hardware version of the radio on your Moteino (uncomment one): //#define FREQUENCY RF69_433MHZ //#define FREQUENCY RF69_868MHZ #define FREQUENCY RF69_915MHZ #define ENCRYPTKEY "sampleEncryptKey" //(16 bytes of your choice - keep the same on all encrypted nodes) -//#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W! +//#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W! -#define LED 9 #define SERIAL_BAUD 115200 #define ACK_TIME 50 // # of ms to wait for an ack #define TIMEOUT 3000 +#ifdef __AVR_ATmega1284P__ + #define LED 15 // Moteino MEGAs have LEDs on D15 +#else + #define LED 9 // Moteinos hsave LEDs on D9 +#endif + RFM69 radio; char c = 0; char input[64]; //serial input buffer diff --git a/Examples/WirelessProgramming_node/WirelessProgramming_node.ino b/Examples/WirelessProgramming_node/WirelessProgramming_node.ino index 70b74dd..80581c4 100644 --- a/Examples/WirelessProgramming_node/WirelessProgramming_node.ino +++ b/Examples/WirelessProgramming_node/WirelessProgramming_node.ino @@ -29,12 +29,19 @@ //#define FREQUENCY RF69_433MHZ //#define FREQUENCY RF69_868MHZ #define FREQUENCY RF69_915MHZ -//#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W! +#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W! #define SERIAL_BAUD 115200 -#define ACK_TIME 50 // # of ms to wait for an ack -#define ENCRYPTKEY "sampleEncryptKey" -#define LED 9 -#define BLINKPERIOD 200 +#define ACK_TIME 30 // # of ms to wait for an ack +#define ENCRYPTKEY "sampleEncryptKey" //(16 bytes of your choice - keep the same on all encrypted nodes) +#define BLINKPERIOD 500 + +#ifdef __AVR_ATmega1284P__ + #define LED 15 // Moteino MEGAs have LEDs on D15 + #define FLASH_SS 23 // and FLASH SS on D23 +#else + #define LED 9 // Moteinos hsave LEDs on D9 + #define FLASH_SS 8 // and FLASH SS on D8 +#endif RFM69 radio; char input = 0; @@ -47,7 +54,7 @@ long lastPeriod = -1; // 0xEF30 for windbond 4mbit flash // 0xEF40 for windbond 16/64mbit flash ///////////////////////////////////////////////////////////////////////////// -SPIFlash flash(8, 0xEF30); //EF30 for windbond 4mbit flash +SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for windbond 4mbit flash void setup(){ pinMode(LED, OUTPUT); @@ -128,6 +135,7 @@ void loop(){ CheckForWirelessHEX(radio, flash, true); Serial.println(); } + //else Serial.print('.'); //////////////////////////////////////////////////////////////////////////////////////////// // Real sketch code here, let's blink the onboard LED @@ -137,4 +145,4 @@ void loop(){ digitalWrite(LED, lastPeriod%2); } //////////////////////////////////////////////////////////////////////////////////////////// -} +} \ No newline at end of file