Arduino Week 1: Push Buttons

For week one of Arduino we had to use a push button to switch states for some LED’s, meaning that when the state is off (button not pressed) the lights are doing one thing, and when the state is on  (button is pressed) the lights are doing another thing.

This is accomplished with saving the state of the button in a variable, and then using it as the parameter of an if/else statement. Nice and easy coding, yay!

Wires were a bit tricky, but I started off using an example from the book that came with my Arduino starter kit, and built several circuits from the beginning, the first requiring no coding at all. This way I learned about different ways to attach buttons to circuits, and the difference between parallel and series circuits – using two buttons to see how in series you had to push both to get the LED lit, while in a parallel, you could push either! (excuse talking in the bg of the video, my mother was over visiting!)

From here it wasn’t so bad to re-set up a single button circuit with 3 LEDs and use their example on switch buttons as a starting point. I traded out lots of the variables to get the lights to blink different ways and better understand the controls.

GitHub Link

Check out my project code on GitHub!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.