Controlling LED with Arduino03 Practical
Controlling LED with Arduino03 Practical
Equipment- (1) Arduino Uno (2) USB A-to-B Cable (3) Breadboard – Half Size (4) LED 5mm (5) 220 Ω Resistor
(6) Jumper Wires
Principle-
The principle of this experiment is very simple. It is very similar with the first class. The for statement is used to repeat a block of
statements enclosed in curly, Braces. An increment counter is usually used to increment and terminate the, Loop. The for
statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of
data/pins. There are three parts to the for loop header:
Processor-The initialization happens first and exactly once. Each time through the loop, the condition is tested; if it's true,
the statement block, and the increment is executed, then the condition is tested again. When the condition becomes false, the loop
ends Compile the program and upload to Arduino UNO board Now, you should see 6 LEDs are lit in sequence from the right
green one to the left, next from the left to the right one. And then repeat the above phenomenon
Project Diagram-
Project Code-
1. Connect the Arduino board to your computer using the USB cable.
2. Open project code and Create coding on Arduino Uno Software Application
4. Click upload button to send sketch to the Arduino Connect an RGB LED to Arduino
Coding: Scrolling LED-
int timer = 100; // The higher the number, the slower the timing.
void setup() {
pinMode(thisPin, OUTPUT);
void loop() {
digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW);
digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW);