SlideShare a Scribd company logo
Introduction to Arduino
Arduino 简介
Objectives 目标
By the end of the lesson, students will be
able to:
1. Understand the basic function of an
Arduino board and associated components.
2. Use Tinkercad to build a virtual circuit
with an LED.
3. Write basic Arduino code to control the
LED.
在课程结束时,学生将能够:
1. 了解 Arduino 板和相关组件
的基本功能。
2. 使用 Tinkercad 构建带有
LED 的虚拟电路。
3. 编写基本的 Arduino 代码来
控制 LED 。
What is Arduino?
- Arduino is a microcontroller board that
can be programmed to control different
electrical components like LEDs, motors,
sensors, etc.
- Microcontroller: A small computer inside
the Arduino that processes commands from
the code you write.
- Digital Input/Output (I/O) Pins: These
pins are used to connect external
components like LEDs, sensors, etc. Pins
can either output voltage (turn something
on, like an LED) or input voltage (read
something, like a button press).
Arduino 是一个微控制器板,可以对
其进行编程以控制不同的电气组件,
如 LED 、电机、传感器等。
微控制器: Arduino 内部的一台小
型计算机,用于处理您编写的代码中
的命令。
- 数字输入 / 输出 ( I/O ) 引脚:这
些引脚用于连接 LED 、传感器等外
部组件。引脚可以输出电压(打开
某个东西,如 LED )或输入电压
(读取某个东西,如按下按钮)。
Components and Their Roles
1. Arduino Uno:
- The main board we will use to control the LED.
- The pins on the Arduino board allow us to connect different
components. We’ll be using pin 13 for output.
1. Arduino Uno :
- 我们将用于控制 LED 的主板。
- Arduino 板上的引脚允许我们连接不同的组件。我们将使用引脚
13 进行输出。
Components and Their Roles
2. Breadboard:
- A tool for building temporary circuits without soldering.
- The breadboard has two sets of holes for components; we use the
horizontal rows to connect different components.
- Two vertical rails are usually reserved for power (+) and ground (GND).
2. 面包板:
- 无需焊接即可构建临时电路的工具。
- 试验板有两组组件孔 ; 我们使用水平行来连接不同的组件。
- 两个垂直导轨通常保留用于电源 ( + ) 和接地 ( GND )。
Components and Their Roles
3. LED (Light Emitting Diode):
- A small light that turns on when electricity flows through it.
- Important: The LED has two legs:
- Anode (longer leg): Connects to the positive (power) side.
- Cathode (shorter leg): Connects to the ground (negative).
3. LED (发光二极管):
- 当电流流过时会亮起的小灯。
- 重要提示: LED 有两个脚管:
- 阳极(较长的腿):连接到正极(电源)侧。
- 阴极(较短的腿):连接到地面(负极)。
Components and Their Roles
4. Resistor (220Ω):
- Limits the current flowing through the LED to prevent it from burning out.
4. 电阻 ( 220Ω ):
- 限制流经 LED 的电流,以防止其烧坏。
5. Wires:
- Used to connect components together on the breadboard.
5. 电线:
- 用于将试验板上的组件连接在一起。
Materials
- Access to Tinkercad (create
accounts prior to the lesson)
- Basic components: Arduino
Uno, Breadboard, LED,
Resistor (220Ω), and wires
(virtual in Tinkercad)
- 访问 Tinkercad (在课前创建
帐户)
- 基本组件: Arduino Uno 、面
包板、 LED 、电阻器
( 220Ω ) 和电线(在
Tinkercad 中虚拟)
1. Place the Arduino Uno on the
workspace in Tinkercad.
2. Add a breadboard to the workspace.
3. Place an LED on the breadboard:
- The anode (long leg) connects to
pin 13 of the Arduino.
- The cathode (short leg) connects to
a 220Ω resistor.
- The other end of the resistor
connects to GND on the Arduino
(Ground).
Connection:
•Arduino pin 13 → LED Anode
•LED Cathode → Resistor
•Resistor → GND on the Arduino
1. 将 Arduino Uno 放在
Tinkercad 的工作区上。
2. 将试验板添加到工作区。
3. 将 LED 放在试验板上:
- 阳极(长腿)连接到 Arduino
的引脚 13 。
- 阴极 (短腿) 连接到一个
220Ω 电阻。
- 电阻器的另一端连接到
Arduino 上的 GND (接地)。
Basic Arduino Code
Task: Control the LED by blinking it on and off with code.
Code Breakdown:
Every Arduino program has two main functions:
1.setup():
1.This function runs once when you start the program.
2.We use it to set up the pin mode (input or output).
2.loop():
1.This function runs continuously (in a loop).
2.It’s where the main logic of the code goes, controlling what the
Arduino does repeatedly.
Basic Arduino Code
Task: Control the LED by blinking it on and off with code.
// Pin number where the LED is connected
int ledPin = 13;
Code Explanation:
• This line declares a variable ledPin that stores the pin
number of the LED. In our case, it’s connected to pin 13.
• The red text that starts with // is called a comment. This is
use to label or describe the code
Basic Arduino Code
Task: Control the LED by blinking it on and off with code.
void setup() {
pinMode(ledPin, OUTPUT);
}
Code Explanation:
• pinMode(): This function sets the mode of a pin, either INPUT
(if you're reading data like a button press) or OUTPUT (if you're
controlling something like an LED).
• Here, pin 13 is being set as an OUTPUT so that we can send
power to it and light up the LED.
Basic Arduino Code
Task: Control the LED by blinking it on and off with code.
void loop() {
digitalWrite(ledPin, HIGH); // Turn on the LED
delay(1000); // Wait for one second
digitalWrite(ledPin, LOW); // Turn off the LED
delay(1000); // Wait for one second
}
Code Explanation:
digitalWrite(ledPin, HIGH): Sends power to the LED, turning it on. HIGH me
on."
delay(1000): Pauses the program for 1000 milliseconds (1 second).
digitalWrite(ledPin, LOW): Turns off the LED by stopping the power flow. LO
"turn off."
Another delay(1000) keeps the LED off for 1 second before looping back and tur
again.
Basic Arduino Code
Task: Control the LED by blinking it on and off with code.
void loop() {
digitalWrite(ledPin, HIGH); // Turn on the LED
delay(1000); // Wait for one second
digitalWrite(ledPin, LOW); // Turn off the LED
delay(1000); // Wait for one second
}
Code Explanation:
digitalWrite(ledPin, HIGH): Sends power to the LED, turning it on. HIGH means "turn
on."
delay(1000): Pauses the program for 1000 milliseconds (1 second).
digitalWrite(ledPin, LOW): Turns off the LED by stopping the power flow. LOW means
"turn off."
Another delay(1000) keeps the LED off for 1 second before looping back and turning it on
again.
Basic Arduino Code
Task 2: Modify the delay time to change the blinking speed of
the LED (e.g., try 500 milliseconds, 2000 milliseconds).
delay(500); // LED blinks every half second
Basic Arduino Code
Task 3:
Challenge the
students to add
a second LED
and alternate
blinking
between the
two.
int ledPin1 = 13; // First LED
int ledPin2 = 12; // Second LED
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
digitalWrite(ledPin1, HIGH); // Turn on first LED
digitalWrite(ledPin2, LOW); // Turn off second LED
delay(1000); // Wait for one second
digitalWrite(ledPin1, LOW); // Turn off first LED
digitalWrite(ledPin2, HIGH); // Turn on second LED
delay(1000); // Wait for one second
}

More Related Content

PPTX
Electronz_Chapter_2.pptx
PDF
02 Sensors and Actuators Understand .pdf
DOCX
Basic arduino sketch example
PDF
Lab 2_ Programming an Arduino.pdf
PDF
Arduino comic v0004
PDF
Arduino Comic-Jody Culkin-2011
PPTX
IoT applications With Arduino coding and real life examples
DOCX
Neno Project.docx
Electronz_Chapter_2.pptx
02 Sensors and Actuators Understand .pdf
Basic arduino sketch example
Lab 2_ Programming an Arduino.pdf
Arduino comic v0004
Arduino Comic-Jody Culkin-2011
IoT applications With Arduino coding and real life examples
Neno Project.docx

Similar to Introduction to Arduino focuses on how arduino can be learned easily (20)

PPT
Intro to Arduino
PPTX
Arduino Workshop (3).pptx
PPTX
Robotics Session day 1
PPTX
Mom presentation_monday_arduino in the physics lab
PPTX
Introduction to Arduino IDE Software-1.pptx
PPTX
Introduction to Arduino IDE Software-1 (1).pptx
PDF
Lab2ppt
PPTX
Project 1 Tutorial 1a rev 2.pptx
DOCX
LEDs and DIPs Switches
PDF
publish manual
PPTX
Arduino programming
PDF
Arduino - Ch 2: Sunrise-Sunset Light Switch
PPTX
Arduino & NodeMcu
PPSX
Arduino اردوينو
PPTX
LED-Arduino-Uno-Hands-on-Science-Project.pptx
PPTX
Shriram Vidyasdzsbhhflay School (4).pptx
PPTX
Chapter 5 Arduino Microcontroller Systems .pptx
PDF
Arduino
PPTX
FIRE ALARM SYSTEM PPT.pptx
Intro to Arduino
Arduino Workshop (3).pptx
Robotics Session day 1
Mom presentation_monday_arduino in the physics lab
Introduction to Arduino IDE Software-1.pptx
Introduction to Arduino IDE Software-1 (1).pptx
Lab2ppt
Project 1 Tutorial 1a rev 2.pptx
LEDs and DIPs Switches
publish manual
Arduino programming
Arduino - Ch 2: Sunrise-Sunset Light Switch
Arduino & NodeMcu
Arduino اردوينو
LED-Arduino-Uno-Hands-on-Science-Project.pptx
Shriram Vidyasdzsbhhflay School (4).pptx
Chapter 5 Arduino Microcontroller Systems .pptx
Arduino
FIRE ALARM SYSTEM PPT.pptx
Ad

Recently uploaded (20)

PPTX
master seminar digital applications in india
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Cell Structure & Organelles in detailed.
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
master seminar digital applications in india
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
01-Introduction-to-Information-Management.pdf
Final Presentation General Medicine 03-08-2024.pptx
Microbial disease of the cardiovascular and lymphatic systems
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
A systematic review of self-coping strategies used by university students to ...
Microbial diseases, their pathogenesis and prophylaxis
202450812 BayCHI UCSC-SV 20250812 v17.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
RMMM.pdf make it easy to upload and study
VCE English Exam - Section C Student Revision Booklet
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Cell Structure & Organelles in detailed.
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Ad

Introduction to Arduino focuses on how arduino can be learned easily

  • 2. Objectives 目标 By the end of the lesson, students will be able to: 1. Understand the basic function of an Arduino board and associated components. 2. Use Tinkercad to build a virtual circuit with an LED. 3. Write basic Arduino code to control the LED. 在课程结束时,学生将能够: 1. 了解 Arduino 板和相关组件 的基本功能。 2. 使用 Tinkercad 构建带有 LED 的虚拟电路。 3. 编写基本的 Arduino 代码来 控制 LED 。
  • 3. What is Arduino? - Arduino is a microcontroller board that can be programmed to control different electrical components like LEDs, motors, sensors, etc. - Microcontroller: A small computer inside the Arduino that processes commands from the code you write. - Digital Input/Output (I/O) Pins: These pins are used to connect external components like LEDs, sensors, etc. Pins can either output voltage (turn something on, like an LED) or input voltage (read something, like a button press). Arduino 是一个微控制器板,可以对 其进行编程以控制不同的电气组件, 如 LED 、电机、传感器等。 微控制器: Arduino 内部的一台小 型计算机,用于处理您编写的代码中 的命令。 - 数字输入 / 输出 ( I/O ) 引脚:这 些引脚用于连接 LED 、传感器等外 部组件。引脚可以输出电压(打开 某个东西,如 LED )或输入电压 (读取某个东西,如按下按钮)。
  • 4. Components and Their Roles 1. Arduino Uno: - The main board we will use to control the LED. - The pins on the Arduino board allow us to connect different components. We’ll be using pin 13 for output. 1. Arduino Uno : - 我们将用于控制 LED 的主板。 - Arduino 板上的引脚允许我们连接不同的组件。我们将使用引脚 13 进行输出。
  • 5. Components and Their Roles 2. Breadboard: - A tool for building temporary circuits without soldering. - The breadboard has two sets of holes for components; we use the horizontal rows to connect different components. - Two vertical rails are usually reserved for power (+) and ground (GND). 2. 面包板: - 无需焊接即可构建临时电路的工具。 - 试验板有两组组件孔 ; 我们使用水平行来连接不同的组件。 - 两个垂直导轨通常保留用于电源 ( + ) 和接地 ( GND )。
  • 6. Components and Their Roles 3. LED (Light Emitting Diode): - A small light that turns on when electricity flows through it. - Important: The LED has two legs: - Anode (longer leg): Connects to the positive (power) side. - Cathode (shorter leg): Connects to the ground (negative). 3. LED (发光二极管): - 当电流流过时会亮起的小灯。 - 重要提示: LED 有两个脚管: - 阳极(较长的腿):连接到正极(电源)侧。 - 阴极(较短的腿):连接到地面(负极)。
  • 7. Components and Their Roles 4. Resistor (220Ω): - Limits the current flowing through the LED to prevent it from burning out. 4. 电阻 ( 220Ω ): - 限制流经 LED 的电流,以防止其烧坏。 5. Wires: - Used to connect components together on the breadboard. 5. 电线: - 用于将试验板上的组件连接在一起。
  • 8. Materials - Access to Tinkercad (create accounts prior to the lesson) - Basic components: Arduino Uno, Breadboard, LED, Resistor (220Ω), and wires (virtual in Tinkercad) - 访问 Tinkercad (在课前创建 帐户) - 基本组件: Arduino Uno 、面 包板、 LED 、电阻器 ( 220Ω ) 和电线(在 Tinkercad 中虚拟)
  • 9. 1. Place the Arduino Uno on the workspace in Tinkercad. 2. Add a breadboard to the workspace. 3. Place an LED on the breadboard: - The anode (long leg) connects to pin 13 of the Arduino. - The cathode (short leg) connects to a 220Ω resistor. - The other end of the resistor connects to GND on the Arduino (Ground). Connection: •Arduino pin 13 → LED Anode •LED Cathode → Resistor •Resistor → GND on the Arduino 1. 将 Arduino Uno 放在 Tinkercad 的工作区上。 2. 将试验板添加到工作区。 3. 将 LED 放在试验板上: - 阳极(长腿)连接到 Arduino 的引脚 13 。 - 阴极 (短腿) 连接到一个 220Ω 电阻。 - 电阻器的另一端连接到 Arduino 上的 GND (接地)。
  • 10. Basic Arduino Code Task: Control the LED by blinking it on and off with code. Code Breakdown: Every Arduino program has two main functions: 1.setup(): 1.This function runs once when you start the program. 2.We use it to set up the pin mode (input or output). 2.loop(): 1.This function runs continuously (in a loop). 2.It’s where the main logic of the code goes, controlling what the Arduino does repeatedly.
  • 11. Basic Arduino Code Task: Control the LED by blinking it on and off with code. // Pin number where the LED is connected int ledPin = 13; Code Explanation: • This line declares a variable ledPin that stores the pin number of the LED. In our case, it’s connected to pin 13. • The red text that starts with // is called a comment. This is use to label or describe the code
  • 12. Basic Arduino Code Task: Control the LED by blinking it on and off with code. void setup() { pinMode(ledPin, OUTPUT); } Code Explanation: • pinMode(): This function sets the mode of a pin, either INPUT (if you're reading data like a button press) or OUTPUT (if you're controlling something like an LED). • Here, pin 13 is being set as an OUTPUT so that we can send power to it and light up the LED.
  • 13. Basic Arduino Code Task: Control the LED by blinking it on and off with code. void loop() { digitalWrite(ledPin, HIGH); // Turn on the LED delay(1000); // Wait for one second digitalWrite(ledPin, LOW); // Turn off the LED delay(1000); // Wait for one second } Code Explanation: digitalWrite(ledPin, HIGH): Sends power to the LED, turning it on. HIGH me on." delay(1000): Pauses the program for 1000 milliseconds (1 second). digitalWrite(ledPin, LOW): Turns off the LED by stopping the power flow. LO "turn off." Another delay(1000) keeps the LED off for 1 second before looping back and tur again.
  • 14. Basic Arduino Code Task: Control the LED by blinking it on and off with code. void loop() { digitalWrite(ledPin, HIGH); // Turn on the LED delay(1000); // Wait for one second digitalWrite(ledPin, LOW); // Turn off the LED delay(1000); // Wait for one second } Code Explanation: digitalWrite(ledPin, HIGH): Sends power to the LED, turning it on. HIGH means "turn on." delay(1000): Pauses the program for 1000 milliseconds (1 second). digitalWrite(ledPin, LOW): Turns off the LED by stopping the power flow. LOW means "turn off." Another delay(1000) keeps the LED off for 1 second before looping back and turning it on again.
  • 15. Basic Arduino Code Task 2: Modify the delay time to change the blinking speed of the LED (e.g., try 500 milliseconds, 2000 milliseconds). delay(500); // LED blinks every half second
  • 16. Basic Arduino Code Task 3: Challenge the students to add a second LED and alternate blinking between the two. int ledPin1 = 13; // First LED int ledPin2 = 12; // Second LED void setup() { pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); } void loop() { digitalWrite(ledPin1, HIGH); // Turn on first LED digitalWrite(ledPin2, LOW); // Turn off second LED delay(1000); // Wait for one second digitalWrite(ledPin1, LOW); // Turn off first LED digitalWrite(ledPin2, HIGH); // Turn on second LED delay(1000); // Wait for one second }