// if enabled the pins will be automatically powered on while awake and off during sleeping (default: true)
voidsetAutoPowerPins(boolvalue);
// manually turn the power on
voidpowerOn();
// manually turn the power off
voidpowerOff();
#endif
~~~
...
...
@@ -361,4 +374,97 @@ A NodeManager object must be created and called from within your sketch during `
* If the destination child id is the configuration node, it will handle the incoming message, otherwise will dispatch the message to the recipient sensor
### Sensor::receive()
* Invoke `Sensor::loop()` which will execute the sensor main taks and eventually call `Sensor::onReceive()`
\ No newline at end of file
* Invoke `Sensor::loop()` which will execute the sensor main taks and eventually call `Sensor::onReceive()`
# Examples
Enable reboot pin, connect pin 4 to RST to enable rebooting the board with the REBOOT message:
~~~c
voidbefore(){
nodeManager.setRebootPin(4);
nodeManager.before();
}
~~~
Set battery minimum and maxium voltage. This will be used to calculate the level percentage:
~~~c
voidbefore(){
nodeManager.setBatteryMin(1.8);
nodeManager.setBatteryMin(3.2);
nodeManager.before();
}
~~~
Instruct the board to sleep for 10 minutes at each cycle:
~~~c
voidbefore(){
nodeManager.setSleep(SLEEP,10,MINUTES);
nodeManager.before();
}
~~~
Configure a wake up pin. When pin 3 is connected to ground, the board will stop sleeping:
~~~c
voidbefore(){
nodeManager.setSleepInterruptPin(3);
nodeManager.before();
}
~~~
Use the arduino pins to power on and off the attached sensors. All the sensors' vcc and ground are connected to pin 6 (ground) and 7 (vcc). NodeManager will enable the vcc pin every time just before loop() and wait for 100ms for the power to settle before running loop() of each sensor:
~~~c
voidbefore(){
nodeManager.setPowerPins(6,7,100);
nodeManager.before();
}
~~~
Register a thermistor sensor attached to pin A2. NodeManager will then send the temperature to the controller at the end of each sleeping cycle:
~~~c
voidbefore(){
nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
nodeManager.before();
}
~~~
Register a LDR sensor attached to pin A1 and send to the gateway the average of 3 samples:
Register a rain sensor connected to A0. This will be powered with via pins 4 (ground) and 5 (vcc) just before reading its value at each cycle, it will be presented as S_RAIN. sending V_RAINRATE messages, the output will be a percentage (calculated between 200 and 2014) and the value will be reversed (so that no rain will be 0%):