@gohan said in My Slim 2AA Battery Node:
Hi, i added a WDT now into the MotionSensorSketch.
Well at least i guess i did. I just read about it , never used it before. Does the 1Mhz Optiboot boatloaders support this ?
Unfortunalty I didnt recieve my 3,3V boosters yet and i dont have LDO´s around.
Concerning the bootloaders. Do you have a suggestion which one to use ? As I read that sticking to 1Mhz is important when using only 2AA batteries because of instability when voltage goes belowe certian values.
Obviously i could use more batteries, but then i cant supply the nRF2401 from the board right ?
// Enable debug prints
// Enable and select radio type attached
#define MY_NODE_ID 40
unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define CHILD_ID 1 // Id of the sensor child
// Initialize motion message
MyMessage msg(CHILD_ID, V_TRIPPED);
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Motion Sensor", "AndyWasHere");
// Register all sensors to gw (they will be created as child devices)
// Read digital motion value
bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
send(msg.set(tripped?"1":"0")); // Send tripped value to gw
// Sleep until interrupt comes in on motion sensor. Send update every two minute.
sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);