Adding button debounce code to project.

I want to add this debounce code to my project, http://playground.arduino.cc/Learning/SoftwareDebounce

This is the project I want to add it to, http://www.instructables.com/files/orig/F7N/V725/HMMF765X/F7NV725HMMF765X.txt

I'm new with arduino and it would be awesome for someone to possibly integrate it?

Welcome to the forum.

it would be awesome for someone to possibly integrate it

Why not have a go yourself ? Report any problems here and you will get plenty of help. The principle is simple. Read the input, read it again a short time later and if it is still in the same state then either it did not bounce or bouncing has finished so it is safe to use the value read.

Thanks I got it working :slight_smile:

Are you sure you have a problem with a switch bouncing?
How do you know?

...R

averythomas:
Thanks I got it working :slight_smile:

Good news.

Now improve the program. Start by declaring the variables with types suitable for the range of values that they will have. For instance, do pin number really have to be ints or could they be bytes ? Then consider making variables that will not change their value (pin numbers again) into consts.

Neither of these really matter in your current program but both are good programming practice and could pay dividends with larger, more complicated programs.