0% found this document useful (0 votes)
18 views2 pages

Experiment 3 Individual Report

The document describes an Arduino programming exercise to create running lights that move from left to right and vice versa using LEDs. It asks the student to modify the existing code to remove an option and use looping functions more efficiently. It then provides explanations of functions like digitalRead(), for(), and delay() that are useful for reading input, repeating blocks of code, and pausing the program. The conclusion states that the student learned about the Arduino IDE and board functionality and created a more efficient program to move lights using for loops rather than just digitalWrite().
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Experiment 3 Individual Report

The document describes an Arduino programming exercise to create running lights that move from left to right and vice versa using LEDs. It asks the student to modify the existing code to remove an option and use looping functions more efficiently. It then provides explanations of functions like digitalRead(), for(), and delay() that are useful for reading input, repeating blocks of code, and pausing the program. The conclusion states that the student learned about the Arduino IDE and board functionality and created a more efficient program to move lights using for loops rather than just digitalWrite().
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

EXERCISES: (For Individual Report)

1. Modify your written code/program of Running lights by removing the option.

Ø Code the program efficiently by using looping functions.

Ø What to expect: Lights will move from Left to Right then Right to Left,
continuously.

int timer = 250;


void setup() {
for (int i = 2; i < 9; i++) {
pinMode(i, OUTPUT);
}
}

void loop() {
for (int i = 2; i < 9; i++) {
digitalWrite(i, HIGH);
delay(timer);
digitalWrite(i, LOW);
}

for (int i = 9; i >= 2; i--) {


digitalWrite(i, HIGH);
delay(timer);
digitalWrite(i, LOW);
}
}

2. What function enables you to read the input from a pin?

The function “digitalRead(pin)” enables the user to read input from a


designated pin. The pin in the function designates which pin the Arduino would
get input from. For example “digitalRead(2)” would provide the user the input
from pin 2.
3. What function enables you to program efficiently the lighting up of several
LED’s?

The function “for()” is used to repeat a block of statements enclosed in curly


braces. An increment counter is commonly used to increment and then end the
loop. This function is very useful when it comes to creating counters or any
repetitive operations.

4. How would you change the amount of time each LED is ON?

The function “delay(ms)” pauses the program for the amount of time (in
milliseconds) specified as parameter. The ms in the function is responsible for
how many milliseconds the delay will last. For example “delay(1000)” would
provide a delay of 1 second as there are 1000 milliseconds in 1 second.

SUMMARY & CONCLUSION:

Through this experiment, the student was able to familiarize with the basic
operations of the Arduino Uno board and Integrated Development Environment
(IDE) and also know the basic functionalities of the IDE.

The experiment deals with creating a program in the Arduino that uses 8
pieces of LED’s in which the lights would move from left to right and vice-versa.
The procedure could be made by the regular digitalWrite() function however the
student used the for() function to make the code shorter and thus making it more
efficient in creating the program.

You might also like