// the pin to connect to the RST pin to reboot the board (default: 4)
voidsetRebootPin(intvalue);
#if BATTERY_MANAGER == 1
// the expected vcc when the batter is fully discharged, used to calculate the percentage (default: 2.7)
voidsetBatteryMin(floatvalue);
// the expected vcc when the batter is fully charged, used to calculate the percentage (default: 3.3)
voidsetBatteryMax(floatvalue);
// how frequently (in hours) to report the battery level to the controller. When reset the battery is always reported (default: 1)
voidsetBatteryReportCycles(intvalue);
#endif
#if SLEEP_MANAGER == 1
// define if the board has to sleep every time entering loop (default: IDLE). It can be IDLE (no sleep), SLEEP (sleep at every cycle), WAIT (wait at every cycle
voidsetSleepMode(intvalue);
// define for how long the board will sleep (default: 0)
voidsetSleepTime(intvalue);
// define the unit of SLEEP_TIME. It can be SECONDS, MINUTES, HOURS or DAYS (default: MINUTES)
voidsetSleep(intvalue1,intvalue2,intvalue3);
voidsetSleepUnit(intvalue);
// if enabled, when waking up from the interrupt, the board stops sleeping. Disable it when attaching e.g. a motion sensor (default: true)
voidsetSleepInterruptPin(intvalue);
#endif
// configure the interrupt pin and mode. Mode can be CHANGE, RISING, FALLING (default: MODE_NOT_DEFINED)
NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects.
NodeManager includes the following main components:
- Sleep manager: allows managing automatically the complexity behind battery-powered sensors spending most of their time sleeping
- Power manager: allows powering on your sensors only while the node is awake
- Battery manager: provides common functionalities to read and report the battery level
- Remote configuration: allows configuring remotely the node without the need to have physical access to it
- Built-in personalities: for the most common sensors, provide embedded code so to allow their configuration with a single line
Documentation available on: https://mynodemanager.sourceforge.io
*/
// load user settings
#include "config.h"
// load MySensors library
#include <MySensors.h>
// load NodeManager library
#include "NodeManager.h"
// create a NodeManager instance
NodeManagernodeManager;
// before
voidbefore(){
// setup the serial port baud rate
Serial.begin(9600);
// connect pin 4 to RST to enable rebooting the board with a message
nodeManager.setRebootPin(4);
// set battery minimum voltage. This will be used to calculate the level percentage
//nodeManager.setBatteryMin(1.8);
// instruct the board to sleep for 10 minutes for each cycle
//nodeManager.setSleep(SLEEP,10,MINUTES);
// When pin 3 is connected to ground, the board will stop sleeping
//nodeManager.setSleepInterruptPin(3)
// all the sensors' vcc and ground are connected to pin 6 (vcc) and 7 (ground). NodeManager will enable the vcc pin every time just before loop() and wait for 100ms for the sensors to settle
//nodeManager.setPowerPins(6,7,100);
// register a thermistor sensor attached to pin A2
MySensors (<https://www.mysensors.org>) is an open source hardware and software community focusing on do-it-yourself home automation and Internet of Things which allows creating original and affordable sensors.
NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects.