Hello and my first collaboration

Hello,

I'm very happy with my first arduino... one arduino leonardo!! and I want to share my first code with all.

I make a little variation of the exemple's codes to make a tap tempo... with two taps on a push-button you can define a on-off led interval.

Thank.

And see you soon.

tapTempo.ino (4.09 KB)

Good work Rafael and Ivan, and welcome to forum.arduino.cc! I hope that you continue to enjoy your Leonardo and stop by here often.

There are certainly improvements you could make to your program. You can continue to make the code smaller, faster and otherwise better, but if it does what you want, then it's a success!

I see you are trying to keep the part count low. You can do a pushbutton by putting the switch between a pin and ground, then initializing it with pinMode(buttonPin, INPUT_PULLUP); Note that the pin, normally HIGH, goes LOW when the switch is closed, which is the opposite behavior of your button.

A forum custom you should be aware of, is to post code inline, between [code]...[/code**]** tags, rather than attaching it. This makes it easy to read on the forum from many different devices, and preserves the integrity of the code. If you just post it in a post, without the tags, it can get mangled.