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:
@@ -9,9 +9,6 @@
|
||||
// to calculate/report flow.
|
||||
//
|
||||
// Sensor on pin 3
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#include <Relay.h>
|
||||
@@ -21,24 +18,15 @@
|
||||
#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 sensor. (Only 2 and 3 generates interrupt!)
|
||||
#define PULSE_FACTOR 1000 // Nummber of blinks per m3 of your meter (One rotation/liter)
|
||||
#define SLEEP_MODE false // flowvalue can only be reported when sleep mode is false.
|
||||
#define MAX_FLOW 40 // Max flow (l/min) value to report. This filetrs outliers.
|
||||
unsigned long SEND_FREQUENCY = 20; // Minimum time between send (in seconds). We don't want to spam the gateway.
|
||||
#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
|
||||
#define CHILD_ID 5 // Id of the sensor child
|
||||
unsigned long SEND_FREQUENCY = 20; // Minimum time between send (in seconds). We don't want to spam the gateway.
|
||||
|
||||
|
||||
|
||||
|
||||
Sensor gw(9,10);
|
||||
|
||||
//enable sleep
|
||||
Sensor gw;
|
||||
Sleep sleep;
|
||||
|
||||
double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter
|
||||
@@ -58,8 +46,7 @@ boolean metric;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(BAUD_RATE); // Used to type in characters
|
||||
gw.begin(RADIO_ID);
|
||||
gw.begin();
|
||||
|
||||
// Register this device as Waterflow sensor
|
||||
gw.sendSensorPresentation(CHILD_ID, S_WATER);
|
||||
|
||||
Reference in New Issue
Block a user