Added new (optional) arguments to begin where you can set PA level and radio channel in sketches and gateway. Default values for constructor and begin arguments also made it possible to simplify all sketches when using defualt ce/cs pins (9,10) for radio and AUTO radion Id mode.
This commit is contained in:
@@ -4,23 +4,16 @@
|
||||
#include <RF24.h>
|
||||
#include <Sensor.h>
|
||||
|
||||
// Set RADIO_ID to something unique in your sensor network (1-254)
|
||||
// or set to AUTO if you want gw to assign a RADIO_ID for you.
|
||||
#define RADIO_ID AUTO
|
||||
|
||||
#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
|
||||
#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
|
||||
#define CHILD_ID 0 // Id of the sensor child
|
||||
|
||||
Sensor gw(9,10);
|
||||
|
||||
Sensor gw;
|
||||
Sleep sleep;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(BAUD_RATE); // Used to type in characters
|
||||
gw.begin(RADIO_ID);
|
||||
gw.begin();
|
||||
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
|
||||
// Register all sensors to gw (they will be created as child devices)
|
||||
gw.sendSensorPresentation(CHILD_ID, S_MOTION);
|
||||
|
||||
Reference in New Issue
Block a user