How to Solve in Tinkercad
Urgent
Lab 1 - Control Multiple LEDs with Arduino UNO
Question 1:
Sketch the schematic diagram in your lab report where 8 LEDs and 8 resistors are connected to the Arduino UNO port D2 to D9.
In this lab, you are required to write an Arduino C code for the following specification:
(A) Pattern Display:
For the 8 LEDs connected to the Arduino, you are required to program the Arduino UNO board to display the following patterns in sequence with a delay:
- First pattern: 10101010 (Delay: 0.5 seconds)
- Second pattern: 11110000 (Delay: 1 second)
- Third pattern: 00001111 (Delay: 0.5 seconds)
- Fourth pattern: 01010101 (Delay: 1 second)
The following information must be followed:
- The pattern should be repeating infinitely (void loop).
- You must use an individual private sub-loop for the program.
- You must use an array method or for-loop to complete your solution.
(B) Running Light:
One LED should light up at each time and will continuously move across the LEDs with an interval of 0.5 seconds from left to right, then from right to left. For example: 01000000 -> 00100000 -> 00010000 -> 00001000.