Time to learn some sweet programming tricks! These will help you write elegant code, whether you're customizing examples or building something from scratch.
Upgrade the example Button sketch, and become a lean, mean, extreme coding machine.
[Note that the code included below has removed the "buttonState" variable declaration in the beginning – since it's no longer used.]
Manipulate numbers without actually using numbers. Skill++ :)
Also, try the other method mentioned in our Servo tutorial (coming soon)! We can also write:
clicks += 1
Learn a bit more about writing to variables with functions and their opposites, while building a circuit that stays on or off until you push the button again. This is a super useful sketch that was requested at one of our meetups!