Digital Electronics Week 2

Part 1)
Code Errors
1) In line 2 of the code there was a “;” missing at the end.
2) In line 7/ the setup, ledpin2 and buttonpin2 has to be added as an output and input.
3) In line 13/ the function there has to be a “checkbutton2”
https://www.tinkercad.com/things/k1wDcr9dX9I

Part2)
Function 1: In this function the switch starts to make the LED blink, all four can be blinking at the same time. However, there is an order to how to the LEDs blink. Even if all of the LED switches are on, the four LEDS turn on in order. Thus, there is never a time in which more than one LED is on. When one LED is on the others are off, then the next one turns on and so one so forth. They do not blink at the same time because in the code, the delay time turning on and off is all set individually for each LED.
Function 2: In this function, the switches can not be all blinking at the same time. Also, if the switches turn on only if the switch number before their number is off. For example, if both switch 1 and 3 is on, switch 1 would have to turn off in order for switch 3 to start blinking. Because of the “else if” statements, the code checks the LEDs in order and turns on only the first LED switch that is on and ignores the other switches that come after it.
Function 3: In this function, the LEDs can all be blinking at the same time. This function differs from the first function in that the LED blinking at the same pace. If all four LED switches are on, then all four LED would turn on and turn off at the same time. They are able to turn on and off at the same time because unlike the first function, this function has the delay time at the end that applies for all four of the LEDs not individual LEDs.

Part3)
https://www.tinkercad.com/things/jSBvtyWTTdo

Leave a comment

Design a site like this with WordPress.com
Get started