NARVASA, YSAVELLE Objectives:
SBECE-1A • Connecting and controlling an LED
attached to an Arduino's digital outputs.
• Blinking lights are designed to disrupt
ACTIVITY 1: 1 LED BLINKING the flow of electricity at regular intervals,
causing the light to flash on and off
Description: indefinitely.
The blinking LED circuit is related to the Coding:
electrical version of the "Hello World" software.
To start, we will focus on flashing an LED, which void setup() {
serves as the microcontroller's Hello World. It's
pinMode(8,OUTPUT);
as simple as turning on and off a light switch.
}
Components and Supplies:
void loop() {
1 × Breadboard
digitalWrite(8 ,HIGH);
1 × Arduino Uno
delay(500);
1 × LED
digitalWrite(8,LOW);
1 × 220Ω Resistor
delay(500);
2 × Jumper
}
Flow Chart:
Schematic Diagram:
START
TURN ON
LED
DELAY
TURN OFF
LED
DELAY
ACTIVITY 2: ALTERNATE BLINKING Objectives:
Description: • Connecting and controlling an LED
attached to an Arduino's digital outputs.
The blinking LED circuit is related to the
• Blinking lights are designed to disrupt
electrical version of the "Hello World" software.
the flow of electricity at regular intervals,
To start, we will focus on flashing an LED, which
causing the light to flash on and off
serves as the microcontroller's Hello World. It's
indefinitely.
as simple as turning on and off a light switch with
2 LEDs. Coding:
Components and Supplies: int REDPIN=13;
1 × Breadboard int YELLOWPIN=12;
1 × Arduino Uno R3
2 × LED void setup() {
2 × 220Ω Resistor //Set the pins to output pins using pinMode
3 × Jumper pinMode(REDPIN,OUTPUT);
Flow Chart: pinMode(YELLOWPIN,OUTPUT);
}
START void loop() {
//Make the LEDs blink in turn:
// Turn on the red led, and turn off the yello and
DELAY green leds.
TURN ON
RED LED
digitalWrite(REDPIN,HIGH);
TURN OFF
DELAY YELLOW LED digitalWrite(YELLOWPIN,LOW);
delay(100);
TURN OFF DELAY
RED LED //Turn in the yellow led, and turn off the red and
green leds.
TURN ON
DELAY YELLOW LED digitalWrite(REDPIN,LOW);
digitalWrite(YELLOWPIN,HIGH);
delay(100);
}
Schematic Diagram: Flow Chart:
START
TURN ON
TURN ON DELAY
GREEN LED
RED LED
TURN OFF DELAY
DELAY YELLOW LED
TURN OFF
TURN OFF DELAY GREEN LED
ACTIVITY 3: TRAFFIC LIGHTS RED LED
Description:
The blinking LED circuit is related to the TURN ON
electrical version of the "Hello World" software. DELAY YELLOW LED
To start, we will focus on flashing an LED, which
serves as the microcontroller's Hello World. It's
as simple as turning on and off a light switch with
2 LEDs.
Coding:
Components and Supplies:
int REDPIN=13;
1 × Breadboard
int YELLOWPIN=12;
1 × Arduino Uno R3
int GREENPIN=11;
3 × LED
3 × 220Ω Resistor
void setup() {
4 × Jumper
//Set the pins to output pins using pinMode
pinMode(REDPIN,OUTPUT);
pinMode(YELLOWPIN,OUTPUT);
pinMode(GREENPIN,OUTPUT);
}
void loop() {
//Make the LEDs blink in turn:
// Turn on the red led, and turn off the yello and Schematic Diagram:
green leds.
digitalWrite(REDPIN,HIGH);
digitalWrite(YELLOWPIN,LOW);
digitalWrite(GREENPIN,LOW);
delay(500);
//Turn in the yellow led, and turn off the red and
green leds.
digitalWrite(REDPIN,LOW);
digitalWrite(YELLOWPIN,HIGH); Analyzation:
digitalWrite(GREENPIN,LOW); • When the jumper wire is not properly
delay(500); inserted, the LEDs will not begin
automatically blink.
• If there is an error in the code you enter
//Turn on the green led, and turn off the red and into the Arduino, it will not operate.
yellow leds. Conclusion:
• I noticed that when generating LED
digitalWrite(REDPIN,LOW); lights with the Arduino Uno, the wire
must be connected into the right digital
digitalWrite(YELLOWPIN,LOW); pin otherwise the LEDs would not work.
digitalWrite(GREENPIN,HIGH); • I also discovered that when I input a code
like pinMode, it must be orange; if it is
delay(500); not a different color, something is wrong
with the code.
• I've also learnt to explore with different
} code, and it's enjoyable when you're
finished.