loading

Debounce arduino push button sketch

Hi,
I have done the following sketch and wiring, i have tried all sorts of Debounce code in the sketch but can't get it to stop.
Most of the sketches i have read and tried switch the led on with one push and off with the second. i just want it to stay on while being pushed and go off while not being pushed, i am working towards RF or Bluetooth but not until i stop this bounce!

Picture of Debounce arduino push button sketch
txcode.jpg
rxcode.jpg
sort by: active | newest | oldest
1-10 of 12Next »
caitlinsdad2 years ago

To properly troubleshoot this, start with only one arduino to get the switch to turn the LED on and off on the same board with the switch.

Senken (author)  caitlinsdad2 years ago

It does do that its just serial communication that seems to be the problem

http://robotic-controls.com/learn/arduino/arduino-...

crossed wires between two arduinos TX-RX, RX-TX, shared ground like MikeR3 suggested.

Senken (author)  caitlinsdad2 years ago

tried that too, thanks btw @MikeR3

I dunno, maybe you have to tweak the delays from that sample code to allow it to communicate.

Senken (author)  caitlinsdad2 years ago

thanks for your help, i had to put a command in to go low if serialprint K was not there, also i needed a delay to ge e voltage p for some reason b all sorted now!

Senken (author) 2 years ago

LED it now on pin 8 and he if is changed to a while.

Video.MOV(516x290) 18 KB
Senken (author) 2 years ago

Thanks, gave them all a try but still the same!

someimes is works sometimes not, i just want it to work wiles being pushed

Video.MOV(516x290) 18 KB
caitlinsdad2 years ago

Also, run the program while looking at the serial monitor, whenever I set up a pull-up resistor switch situation, you can never be sure if it goes high when pressed or is low in its unpressed state. You can set up the switch using the internal pullup on certain arduino pins without the added resistor. Depending on the Arduino, it may return a value opposite of what you expect.

MikeR32 years ago

First thing I would do:

In the Rx system, use a pin other than 13. Change the wiring and the "int led =13;" to some other DIO pin.

I'm not sure if that's your problem, but I've always had problems at boot with using pin13.

1-10 of 12Next »