Week 4:Arduino Programming

Circuits with like Code

Image of Simple Circuit

Objectives:

  • Build an a circuit that includes Arduino code

The Circuit

For my circuit, I wanted to have a yellow light that flashes at a certain rate. When a button is pushed the yellow light should turn off and a blue light should turn on and flash at a faster rate. I knew that on each pathway that contained either the button, the blue light, or the yellow light, I'd have to incorporate a 1000 Ohm resistor to reduce the current to a safe level that wouldn't damage any of the components. I took both inspiration and instruction for this idea from the Arduino Project Book's second project. I knew that both my yellow and blue lights would be outputs, so I connected them to a channel and then to ground. For my button, since it was the input, it was connected to the 3V channel and then to another channel.

Image of the circuit

The Code

Of course the circuit won't work without the code to tell it what to do. Below I've included my code with comments explaining the purpose of each line.


Arduino Code

I Blink I Can

He blinks faster when pressure is applied, kind of like a Harvard student.


Gif of Circuit Working

Return home