IoT Experiment 1-6: LED experiments with Arduino uno
Lab 1: Blinking of an LED
Aim: To demonstrate Blinking of an LED in Arduino uno
Components Required:
Ardunio Uno
Jumper wires
Breadboard
LED
Register
Connection Diagram:
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
Result:
Lab 2: Blinking of LED alternatively in Arduino uno
Aim: To demonstrate Blinking of an LED alternatively in Arduino uno
Components Required:
Ardunio Uno
Jumper wires
Breadboard
LED
Register
Connection Diagram:
Code:
Lab 3: Scrolling of 6 LEDs in Arduino uno
Aim: To demonstrate scrolling of 6 LEDs in Arduino uno
Components required:
Ardunio Uno
Jumper wires
Breadboard
LED
Register
Connection Diagram:
Code:
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);
}
}
Lab 4: Scrolling of 6 LEDs back and front in Arduino uno
Aim: To demonstrate Scrolling of 6 LEDs back and front in Arduino uno
Components Required:
Ardunio Uno
Jumper wires
Breadboard
LED
Register
Connection diagram:
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);
}
}
Result:
Successfully demonstrated scrolling of 6 LED back and front
Lab 5: Blinking of 6 Leds in Arduino uno
Aim: To demonstrate Blinking of 6 LED in Arduino uno
Components required:
Ardunio Uno
Jumper wires
Breadboard
LEDs
Registers
Connection diagram
Code:
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() {
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
delay(timer);
}
Result:
Successfully demonstrated Blinking of 6 LEDs
Lab 6: Blinking 6 LEDs in ODD and EVEN fashion in arduino uno
Aim: To demonstrate blinking 6 LEDs in ODD and EVEN fashion
Components required:
Ardunio Uno
Jumper wires
Breadboard
LEDs
Registers
Connection diagram:
Code:
int timer = 1000; // 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() {
for (int i=0;i<20;i++)
{
if(i%2==0)
{
digitalWrite(2, HIGH);
digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(3, LOW);
digitalWrite(5, LOW);
digitalWrite(7, LOW);
delay(timer);
} else {
digitalWrite(3, HIGH);
digitalWrite(5, HIGH);
digitalWrite(7, HIGH);
// turn the pin off:
digitalWrite(2, LOW);
digitalWrite(4, LOW);
digitalWrite(6, LOW);
delay(timer);
}
}
}
Result:
Successfully demonstrated Blinking 6 LEDs in ODD and EVEN fashion



