0% found this document useful (0 votes)
9 views

Controlling LED with Arduino03 Practical

This document outlines a project to create a scrolling LED effect using an Arduino Uno, where 6 LEDs blink in a back and forth pattern. It details the necessary equipment, principles of using a for loop for repetitive operations, and provides step-by-step instructions for coding and connecting the hardware. The provided code demonstrates how to control the LEDs using digital pins and timing delays.

Uploaded by

manojdhawan2017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Controlling LED with Arduino03 Practical

This document outlines a project to create a scrolling LED effect using an Arduino Uno, where 6 LEDs blink in a back and forth pattern. It details the necessary equipment, principles of using a for loop for repetitive operations, and provides step-by-step instructions for coding and connecting the hardware. The provided code demonstrates how to control the LEDs using digital pins and timing delays.

Uploaded by

manojdhawan2017
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical-01

Aim/Object- Study about the Scrolling LED with Arduino


This project will blink 6 LEDs, one at a time, in a back and forth formation. This type of circuit was made famous by the show
Knight Rider which featured a car with looping LEDs.

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

3. Select the board and serial port as outlined in earlier section.

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() {

// use a for loop to initialize each pin as an output:

for (int thisPin = 2; thisPin < 8; thisPin++) {

pinMode(thisPin, OUTPUT);

void loop() {

// loop from the lowest pin to the highest:

for (int thisPin = 2; thisPin < 8; thisPin++) {

// turn the pin on:

digitalWrite(thisPin, HIGH);

delay(timer);

// turn the pin off:

digitalWrite(thisPin, LOW);

// loop from the highest pin to the lowest:

for (int thisPin = 7; thisPin >= 2; thisPin--) {

// turn the pin on:

digitalWrite(thisPin, HIGH);

delay(timer);

// turn the pin off:

digitalWrite(thisPin, LOW);

You might also like