#define BTN_INT_PIN 18 // INT pin #define BTN_PIN1 0 // button pin #define BTN_PIN2 20 // button pin #define CONTROL_GROUP 1 // number of Association Group #define SWITCH_ON 0xff #define SWITCH_OFF 0 ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE); // Send Turn On/Off command to associated devices ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING); // Sleeping mode byte lastValue1 = HIGH; byte lastValue2 = HIGH; // the setup routine runs once when you press reset: void setup() { pinMode(BTN_PIN1, INPUT_PULLUP); pinMode(BTN_PIN2, INPUT_PULLUP); } // the loop routine runs over and over again forever: void loop() { byte currentValue1 = digitalRead(BTN_PIN1); byte currentValue2 = digitalRead(BTN_PIN2); // Button Down if (currentValue1 != lastValue1) { // if state changes lastValue1 = currentValue1; // save new state if (lastValue1 == LOW) { zunoSendToGroupSetValueCommand(CONTROL_GROUP, SWITCH_OFF); // if button pressed - send switch OFF command } } // Button Up if (currentValue2 != lastValue2) { // if state changes lastValue2 = currentValue2; // save new state if (lastValue2 == LOW) { zunoSendToGroupSetValueCommand(CONTROL_GROUP, SWITCH_ON); // if button pressed - send switch ON command } } // Go to sleep after release the button if (digitalRead(BTN_INT_PIN)){ zunoSendDeviceToSleep(); } }