I have the code (I am still noob) - http://pastebin.com/UZFRMXuf . I connected one DHT-22, two relays and switch to ethernet gateway. As I am noob, I used few examples from my sensors library. But I want to change lines 125-137. I want to use doorbell switch (I don't know how to name it correctly). But the idea is: when I push and release switch, the lights turn on, when I do it again, lights turn off. How can I modify the code? I tried this, but unsuccessfully:
Code: Select all
if (value != oldValue) {
for (int count = 0; count > 2; count ++) {
// Send in the new value
send(msg.set(value==HIGH ? 1 : 0));
//digitalWrite(5, value);
}
oldValue = value;
}