#include "Arduino.h" #include #include // Pins #define SWITCH 0 #define SENDER 2 ContactSensor sensor = ContactSensor(LIGHT_SENSOR, SENDER); void setup() { pinMode(SWITCH, INPUT_PULLUP); sensor.setup(); sensor.sendStateAndVoltage(readState()); TinyPower::setup(); } void loop() { TinyPower::sleep(); } boolean readState() { return digitalRead(SWITCH); } ISR(PCINT0_vect) { sensor.sendStateAndVoltage(!readState()); }