Count RISING edges of a wave form by using ARDUINO
I have choosen the values of R and C by experiments. Do you have a suggest for choose these values?


I have a page about switches - somewhat down the page is a discussion of debouncing, including some calculations which show how you can calculate the debounce time. With the switch pin pulled high by the internal pull-up (something you don't appear to be doing), and a 1 µF capacitor, that gives you a debounce of about 35 ms.



Example schematic:



Results on input pin:



(Maths supporting that figure on the above page).



Note that it is important to have a pull-up or pull-down for your switch or it will read random values if not closed.