Back

Andy's Assignment 2!

Here is an image of my circuit.

Here is an gif of my circuit working. The LEDs blink and turn on/off depending on if I press the button.

In this circuit I used 2 different types of LEDs. The yellow LED has a voltage drop of 1.8 v, and the white has a voltage drop of 3.3 v. I had to choose resistors that provided the recommended 20 a. For the yellow LED's resistor, I needed a (5 - 1.8) / .02 = 160 ohm resistor. The closest resistor I had to this was 220 ohm (I went over to make sure I didn't short the LED). For the white LED's resistor, I needed a (5 - 3.3) / .02 = 85 ohm resistor. The closest resistor I had to this was 100 ohm (I went over to make sure I didn't short the LED). I went with a 10k ohm resistor for my switch to avoid an open circuit and to keep the pin grounded when the switch is closed.

Here is my code with comments explaining how it works.