Но стало интересно это так задано по умолчанию или я где то что задваиваю?
Код вроде простейший
Code: Select all
//
#define RelePin 9
#define BtnPin 10
#define SWITCH_ON 0xff
#define SWITCH_OFF 0
//
byte switchValue = 0;
byte lastBtnValue = 0;
//
ZUNO_SETUP_CHANNELS(
ZUNO_SWITCH_BINARY(getterSwitch, setterSwitch),
ZUNO_SENSOR_BINARY_TAMPER (getterBtn)
);
void setup() {
pinMode(RelePin, OUTPUT);
pinMode(BtnPin, INPUT_PULLUP);
}
void loop() {
byte currentBtnValue;
currentBtnValue = digitalRead(BtnPin);
if (currentBtnValue != lastBtnValue) {
lastBtnValue = currentBtnValue;
zunoSendReport(2);
}
}
//
void setterSwitch(byte value) {
digitalWrite(RelePin, (value > 0) ? HIGH : LOW);
switchValue = value;
}
byte getterSwitch(){
return switchValue;
}
byte getterBtn(void) {
return lastBtnValue ? 0xff : 0;
}