debounce into sketch??

Hello,
I've been busy for a while and don't get it for each other.I would like to Exchange circuit with a pulse light switch and ethernet switch. When I turn on the lights with the light switch and with the app back out and vice versa.

Can someone help me here.

sketch_feb23a.ino (13.1 KB)

I've been busy for a while and don't get it for each other.

I don't get what you are trying to say here, either.

I would like to Exchange circuit with a pulse light switch and ethernet switch.

Exchange it with what? What is a "pulse light switch"? If you want to turn on a circuit using either a switch or a command from a web site, that is possible.

When I turn on the lights with the light switch and with the app back out and vice versa.

I don't understand this.

I try explaining.

I would like to set 1 LED light on 2 places. 1 place it's the puls switch on the wall and the 2 switch is with a app on my phone.

I can now switch the LED on and off with my phone thats working good. but when I get a pulse switch put on an input on the arduino it's not working. i have tray the debounce sketch into my sketch and tray to switch the led about 2 places. then it's looks like 1 input is master and dominated the other input.

I would like to switch the led on with the app and then switch it off with the switch on the wall. Or switch it on with the switch on the wall and off with the app.

I dont know how to call it but it's like home circuit to switch one lamp with 2 switches.

I hope you know what I mean.

OK, from what you say, you have a phone that talks to the Arduino, which in turn turns the light on or off. You now want to be able to turn the light on/off with the switch (presumably on the Arduino). Am I right?

Can you show us the code that does it from the phone?

Yes that is right. I want to set the switch on a input from the Arduino.

sketch_feb23a.ino (13.1 KB)

Well, I am only going to describe what needs to be done, because that is one large piece of code, and I am not about to wade through it to figure out what all it does, and where you might tie in the code to switch the lights.

  1. Place your switch check and debounce code in loop()
  2. When the switch is activated, turn the light (or all the lights, or some number of lights) on or off, as you wish.

You should have a look at debounce code. A good tutorial on switches if here: http://www.gammon.com.au/forum/?id=11955

As for changing the light(s), could just split that last, (very poorly formatted) if statement right near the end of the code, out into a separate function, and call it when you detect a switch press. However, you probably also want to change some variables ( state_kamer and state_keuker for sure, but there may be others.

Good luck!