Lab 4: Arduino + Circuit

For this lab, I had to create a circuit with 2 LED’s and a switch (in my case, a momentary pushbutton switch). When connected to the Arduino Uno and programmed, the Arduino instructs the yellow LED to go out when the button is pushed, and the red LED to turn on.


  • 1 breadboard
  • 2 LED’s (one yellow and one red)
  • jumper wire of some kind
  • 2 330 Ω resistors
  • 1 10 kΩ resistor
  • 1 pushbutton momentary switch
  • 1 Arduino Uno


To be honest, this took me FOREVER. After trying a few attempts at following the schematic exactly, I decided to start from the top: I first created a circuit powered by the Arduino using one LED, that blinked on a timer.


I next had to add my next LED, and then integrate the switch before I could begin coding.

Screen Shot 2017-02-07 at 11.19.08 PM.png

Basically, the above code first dictates to the Arduino if the utilized pins are inputs or outputs. Both LED’s are outputs: they respond to something in the environment and give off some kind of feedback. The switch is an input: it does something physically elsewhere on the board when pressed.

This as well took a few iterations in order to get used to the coding environment (it took me a few tries to set the switch to “1” in my loop code in order to get it working). The loop just means the yellow LED remains on, unless the button is pressed: in which case the red LED comes on, and the yellow goes off.

This is obviously very simple, but it did take a bit of work, and I was over the moon when it finally worked as expected/hoped!


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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