Time to learn some sweet programming tricks! These will help you write elegant code, whether you're customizing examples or building something from scratch.1. Streamline your Button sketch
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.]2. Counting with variables
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!