Arduino – Controlling LEDs
Session 2
Tues 10th Sep
Arduino – Controlling LEDs
Session 2
Tues 10th Sep
Learning Objectives
At the end of the lesson you will be able to understand the basics of controlling LEDs with an Arduino.
At the end of the lesson you will be able to write and upload simple Arduino sketches to blink an LED.
At the end of the lesson you will be able to modify Arduino code to change LED blinking rate.
At the end of the lesson you will be able to control multiple LEDs with an Arduino.
What do you already know about controlling LEDs with Arduino?
Introduction to controlling LEDs with Arduino
Understanding the basics of using an Arduino to control LEDs.
1-Connection (how to connect LED & Arduino together)
2-Protective resistor
Instructions for controlling an external LED with Arduino
Emphasizing the need for a resistor and correct polarity when controlling an external LED.
Understanding electrical signals in the context of Arduino
Explaining HIGH and LOW signals in the context of Arduino and their significance.
Step-by-step guide to blinking an on-board LED
Explaining how to blink the on-board LED connected to digital pin 13 using the 'Blink' program.
Changing the digital pin used to control an LED
Providing instructions for changing the pin that powers the LED.
Controlling multiple LEDs and synchronizing their blink rate
Explaining how to control multiple LEDs and synchronize their blinking by adjusting the program code.
Definition List
HIGH signal
LOW signal
delay()
pinMode()
digitalWrite()
Write down 3 things you learned in this lesson.
Ask 1 question about something you haven't quite understood yet.
which one is a digital input?
Temperature sensor
LED
Button
Speaker
which one is output?
Temperature sensor
LED
Button
Speaker
Which function is used to initialize code in an Arduino program?
begin()
setup()
start()
init()
Which Arduino function is used for running code continuously?
run()
repeat()
loop()
forever()
What is the default baud rate for serial communication in Arduino?
4800
9600
14400
19200
What does the 'digitalRead()' function do in Arduino?
Reads an analog value from a pin
Sets a digital pin to HIGH
Reads a digital value from a pin
Turns on an LED
How do you write a value to a digital pin in Arduino?
analogWrite(pin, value)
digitalWrite(pin, value)
writeDigital(pin, value)
pinWrite(pin, value)
What is the correct syntax for defining a variable in Arduino?
var int = 5;
define int 5;
int myVariable = 5;
set int 5;
Write down 2 types of variables in Arduino