Fix some examples defines
This commit is contained in:
parent
a4b17da796
commit
d220cc7ad0
|
|
@ -50,9 +50,9 @@
|
|||
#define NODEID 1 //unique for each node on same network
|
||||
#define NETWORKID 100 //the same on all nodes that talk to each other
|
||||
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
|
||||
#define FREQUENCY RF69_433MHZ
|
||||
//#define FREQUENCY RF69_433MHZ
|
||||
//#define FREQUENCY RF69_868MHZ
|
||||
//#define FREQUENCY RF69_915MHZ
|
||||
#define FREQUENCY RF69_915MHZ
|
||||
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
|
||||
#define IS_RFM69HW_HCW //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
|
||||
//*********************************************************************************************
|
||||
|
|
@ -65,21 +65,13 @@
|
|||
//*********************************************************************************************
|
||||
#define SERIAL_BAUD 115200
|
||||
|
||||
#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 have LEDs on D9
|
||||
#define FLASH_SS 8 // and FLASH SS on D8
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_ATC
|
||||
RFM69_ATC radio;
|
||||
#else
|
||||
RFM69 radio;
|
||||
#endif
|
||||
|
||||
SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit Windbond chip (W25X40CL)
|
||||
SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF30 for 4mbit Windbond chip (W25X40CL)
|
||||
bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network
|
||||
|
||||
void setup() {
|
||||
|
|
@ -214,7 +206,7 @@ void loop() {
|
|||
}
|
||||
}
|
||||
Serial.println();
|
||||
Blink(LED,3);
|
||||
Blink(LED_BUILTIN,3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Sends periodic messages of increasing length to gateway (id=1)
|
||||
// It also looks for an onboard FLASH chip, if present
|
||||
// **********************************************************************************
|
||||
// Copyright Felix Rusu 2016, http://www.LowPowerLab.com/contact
|
||||
// Copyright Felix Rusu 2018, http://www.LowPowerLab.com/contact
|
||||
// **********************************************************************************
|
||||
// License
|
||||
// **********************************************************************************
|
||||
|
|
@ -36,9 +36,9 @@
|
|||
#define NETWORKID 100 //the same on all nodes that talk to each other (range up to 255)
|
||||
#define GATEWAYID 1
|
||||
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
|
||||
#define FREQUENCY RF69_433MHZ
|
||||
//#define FREQUENCY RF69_433MHZ
|
||||
//#define FREQUENCY RF69_868MHZ
|
||||
//#define FREQUENCY RF69_915MHZ
|
||||
#define FREQUENCY RF69_915MHZ
|
||||
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
|
||||
#define IS_RFM69HW_HCW //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
|
||||
//*********************************************************************************************
|
||||
|
|
@ -51,14 +51,6 @@
|
|||
#define ATC_RSSI -80
|
||||
//*********************************************************************************************
|
||||
|
||||
#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 have LEDs on D9
|
||||
#define FLASH_SS 8 // and FLASH SS on D8
|
||||
#endif
|
||||
|
||||
#define SERIAL_BAUD 115200
|
||||
|
||||
int TRANSMITPERIOD = 200; //transmit a packet to gateway so often (in ms)
|
||||
|
|
@ -66,7 +58,7 @@ char payload[] = "123 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|||
char buff[20];
|
||||
byte sendSize=0;
|
||||
boolean requestACK = false;
|
||||
SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit Windbond chip (W25X40CL)
|
||||
SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF30 for 4mbit Windbond chip (W25X40CL)
|
||||
|
||||
#ifdef ENABLE_ATC
|
||||
RFM69_ATC radio;
|
||||
|
|
@ -185,7 +177,7 @@ void loop() {
|
|||
radio.sendACK();
|
||||
Serial.print(" - ACK sent");
|
||||
}
|
||||
Blink(LED,3);
|
||||
Blink(LED_BUILTIN,3);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
|
@ -218,6 +210,6 @@ void loop() {
|
|||
}
|
||||
sendSize = (sendSize + 1) % 31;
|
||||
Serial.println();
|
||||
Blink(LED,3);
|
||||
Blink(LED_BUILTIN,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,60 @@
|
|||
#include <RFM69.h>
|
||||
#include <SPI.h>
|
||||
#include <SPIFlash.h>
|
||||
|
||||
// **********************************************************************************
|
||||
// Struct Receive RFM69 Example
|
||||
// **********************************************************************************
|
||||
// Copyright Felix Rusu 2018, http://www.LowPowerLab.com/contact
|
||||
// **********************************************************************************
|
||||
// License
|
||||
// **********************************************************************************
|
||||
// This program is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General
|
||||
// Public License as published by the Free Software
|
||||
// Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will
|
||||
// be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
// implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
// PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// Licence can be viewed at
|
||||
// http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
//
|
||||
// Please maintain this license information along with authorship
|
||||
// and copyright notices in any redistribution of this code
|
||||
// **********************************************************************************
|
||||
#include <RFM69.h> //get it here: https://www.github.com/lowpowerlab/rfm69
|
||||
#include <RFM69_ATC.h> //get it here: https://www.github.com/lowpowerlab/rfm69
|
||||
#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash
|
||||
#include <SPI.h> //included with Arduino IDE install (www.arduino.cc)
|
||||
//*********************************************************************************************
|
||||
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
|
||||
//*********************************************************************************************
|
||||
#define NODEID 1
|
||||
#define NETWORKID 100
|
||||
#define FREQUENCY RF69_433MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
|
||||
#define KEY "sampleEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less!
|
||||
#define LED 9
|
||||
#define SERIAL_BAUD 115200
|
||||
#define ACK_TIME 30 // # of ms to wait for an ack
|
||||
//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" //has to be same 16 characters/bytes on all nodes, not more not less!
|
||||
#define IS_RFM69HW_HCW //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
|
||||
//*********************************************************************************************
|
||||
//Auto Transmission Control - dials down transmit power to save battery
|
||||
//Usually you do not need to always transmit at max output power
|
||||
//By reducing TX power even a little you save a significant amount of battery power
|
||||
//This setting enables this gateway to work with remote nodes that have ATC enabled to
|
||||
//dial their power down to only the required level
|
||||
#define ENABLE_ATC //comment out this line to disable AUTO TRANSMISSION CONTROL
|
||||
//*********************************************************************************************
|
||||
#define SERIAL_BAUD 115200
|
||||
|
||||
RFM69 radio;
|
||||
SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip
|
||||
#ifdef ENABLE_ATC
|
||||
RFM69_ATC radio;
|
||||
#else
|
||||
RFM69 radio;
|
||||
#endif
|
||||
|
||||
SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF40 for 16mbit windbond chip
|
||||
bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -29,7 +71,7 @@ void setup() {
|
|||
#ifdef IS_RFM69HW_HCW
|
||||
radio.setHighPower(); //must include this only for RFM69HW/HCW!
|
||||
#endif
|
||||
radio.encrypt(KEY);
|
||||
radio.encrypt(ENCRYPTKEY);
|
||||
radio.promiscuous(promiscuousMode);
|
||||
char buff[50];
|
||||
sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
|
||||
|
|
@ -49,7 +91,7 @@ void loop() {
|
|||
if (input == 'r') //d=dump all register values
|
||||
radio.readAllRegs();
|
||||
if (input == 'E') //E=enable encryption
|
||||
radio.encrypt(KEY);
|
||||
radio.encrypt(ENCRYPTKEY);
|
||||
if (input == 'e') //e=disable encryption
|
||||
radio.encrypt(null);
|
||||
if (input == 'p')
|
||||
|
|
@ -129,7 +171,7 @@ void loop() {
|
|||
}
|
||||
}
|
||||
Serial.println();
|
||||
Blink(LED,3);
|
||||
Blink(LED_BUILTIN,3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,4 +181,4 @@ void Blink(byte PIN, int DELAY_MS)
|
|||
digitalWrite(PIN,HIGH);
|
||||
delay(DELAY_MS);
|
||||
digitalWrite(PIN,LOW);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,65 @@
|
|||
#include <RFM69.h>
|
||||
#include <SPI.h>
|
||||
#include <SPIFlash.h>
|
||||
|
||||
// **********************************************************************************
|
||||
// Struct Send RFM69 Example
|
||||
// **********************************************************************************
|
||||
// Copyright Felix Rusu 2018, http://www.LowPowerLab.com/contact
|
||||
// **********************************************************************************
|
||||
// License
|
||||
// **********************************************************************************
|
||||
// This program is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General
|
||||
// Public License as published by the Free Software
|
||||
// Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will
|
||||
// be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
// implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
// PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// Licence can be viewed at
|
||||
// http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
//
|
||||
// Please maintain this license information along with authorship
|
||||
// and copyright notices in any redistribution of this code
|
||||
// **********************************************************************************
|
||||
#include <RFM69.h> //get it here: https://www.github.com/lowpowerlab/rfm69
|
||||
#include <RFM69_ATC.h> //get it here: https://www.github.com/lowpowerlab/rfm69
|
||||
#include <SPIFlash.h> //get it here: https://www.github.com/lowpowerlab/spiflash
|
||||
#include <SPI.h> //included with Arduino IDE install (www.arduino.cc)
|
||||
//*********************************************************************************************
|
||||
//************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
|
||||
//*********************************************************************************************
|
||||
#define NODEID 99
|
||||
#define NETWORKID 100
|
||||
#define GATEWAYID 1
|
||||
#define FREQUENCY RF69_433MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
|
||||
#define KEY "sampleEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less!
|
||||
#define LED 9
|
||||
#define SERIAL_BAUD 115200
|
||||
#define ACK_TIME 30 // # of ms to wait for an ack
|
||||
//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" //has to be same 16 characters/bytes on all nodes, not more not less!
|
||||
#define IS_RFM69HW_HCW //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
|
||||
//*********************************************************************************************
|
||||
//Auto Transmission Control - dials down transmit power to save battery
|
||||
//Usually you do not need to always transmit at max output power
|
||||
//By reducing TX power even a little you save a significant amount of battery power
|
||||
//This setting enables this gateway to work with remote nodes that have ATC enabled to
|
||||
//dial their power down to only the required level
|
||||
#define ENABLE_ATC //comment out this line to disable AUTO TRANSMISSION CONTROL
|
||||
//*********************************************************************************************
|
||||
#define SERIAL_BAUD 115200
|
||||
|
||||
#ifdef ENABLE_ATC
|
||||
RFM69_ATC radio;
|
||||
#else
|
||||
RFM69 radio;
|
||||
#endif
|
||||
|
||||
SPIFlash flash(SS_FLASHMEM, 0xEF30); //EF40 for 16mbit windbond chip
|
||||
|
||||
int TRANSMITPERIOD = 300; //transmit a packet to gateway so often (in ms)
|
||||
byte sendSize=0;
|
||||
boolean requestACK = false;
|
||||
SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip
|
||||
RFM69 radio;
|
||||
|
||||
typedef struct {
|
||||
int nodeId; //store this nodeId
|
||||
|
|
@ -31,7 +74,7 @@ void setup() {
|
|||
#ifdef IS_RFM69HW_HCW
|
||||
radio.setHighPower(); //must include this only for RFM69HW/HCW!
|
||||
#endif
|
||||
radio.encrypt(KEY);
|
||||
radio.encrypt(ENCRYPTKEY);
|
||||
char buff[50];
|
||||
sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
|
||||
Serial.println(buff);
|
||||
|
|
@ -60,7 +103,7 @@ void loop() {
|
|||
if (input == 'r') //d=dump register values
|
||||
radio.readAllRegs();
|
||||
//if (input == 'E') //E=enable encryption
|
||||
// radio.encrypt(KEY);
|
||||
// radio.encrypt(ENCRYPTKEY);
|
||||
//if (input == 'e') //e=disable encryption
|
||||
// radio.encrypt(null);
|
||||
|
||||
|
|
@ -105,7 +148,7 @@ void loop() {
|
|||
Serial.print(" - ACK sent");
|
||||
delay(10);
|
||||
}
|
||||
Blink(LED,5);
|
||||
Blink(LED_BUILTIN,5);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +167,7 @@ void loop() {
|
|||
Serial.print(" ok!");
|
||||
else Serial.print(" nothing...");
|
||||
Serial.println();
|
||||
Blink(LED,3);
|
||||
Blink(LED_BUILTIN,3);
|
||||
lastPeriod=currPeriod;
|
||||
}
|
||||
}
|
||||
|
|
@ -135,4 +178,4 @@ void Blink(byte PIN, int DELAY_MS)
|
|||
digitalWrite(PIN,HIGH);
|
||||
delay(DELAY_MS);
|
||||
digitalWrite(PIN,LOW);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue