SlideShare a Scribd company logo
1 of 9
1
Arduino Tutorial #2
- Blink the built-in LED &
Control the external LED -
Dong Ho Son
POSTECH
Pohang, Korea
donghoson@postech.ac.kr
2
Blink the built-in LED - Overview
 Let’s blink the LED
• Simple code
• Turn on the built-in LED
− Built-in LED for test
− Internally connected to digital pin #13
Source: pixabay.com/photo-2168193
3
Blink the built-in LED - Sketch
 setup() { }
• pinMode(13, OUTPUT);
− Prepare the mode of pin
− We will use pin #13
− We will order to LED  OUTPUT
 loop() { }
• digitalWrite(13, HIGH);
− Turn on the built-in LED
• Delay(1000);
− Need 1 sec (1000ms) to check step-by-step
• digitalWrite(13, LOW);
− Turn off the built-in LED
4
Blink the built-in LED - Result
 Built-in LED blinks!
LED OFF!LED ON!
Source: pixabay.com/photo-2168193
5
Control external LED - Overview
 Jumper cables
• Pin #2  Breadboard
• Breadboard  GND (Ground)
 LED
• Longer lead (Positive)  Pin #2
• Shorter lead (Negative)  Resistor
 Resistor
• Necessary to protect the LED
 Breadboard
• Power rails
− The top and bottom rows of holes are connected horizontally
• Terminal strips
− Remaining holes are connected vertically
Positive
Negative
Power rails
Terminal strips
Source: pixabay
6
Control external LED – Circuit
 Configure the circuit
• Jumper cables
• LED
• Resistor (220 Ohm)
• Breadboard
+-
Source: pixabay.com/photo-2168193
7
Control external LED - Sketch
 setup() { }
• pinMode(2, OUTPUT);
− Prepare the mode of pin
− We will use pin #2
− We will order to LED  OUTPUT
 loop() { }
• digitalWrite(2, HIGH);
− Turn on the built-in LED
• Delay(500);
− Need 0.5 sec (500ms) to check step-by-step
• digitalWrite(2, LOW);
− Turn off the built-in LED
8
Control the external LED - Result
 External LED blinks!
+-
Source: pixabay.com/photo-2168193
9
How to Use a Breadboard
 If you are not familiar with how to use a breadboard, please take a
look at the following tutorial on how to use a breadboard
https://www.sciencebuddies.org/science-fair-projects/references/how-
to-use-a-breadboard
 Watch the video first

More Related Content

Similar to Arduino tutorial #2

Internet of thing: Trabajando con Arduino y Visual Studio
Internet of thing: Trabajando con Arduino y Visual StudioInternet of thing: Trabajando con Arduino y Visual Studio
Internet of thing: Trabajando con Arduino y Visual StudioBruno Capuano
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino FoundationsJohn Breslin
 
Prižiganje lučk z Arduinom
Prižiganje lučk z ArduinomPrižiganje lučk z Arduinom
Prižiganje lučk z ArduinomMaja Kraljič
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationArkhom Jodtang
 
visible light follower robot by nagaraju.m
visible light follower robot by nagaraju.mvisible light follower robot by nagaraju.m
visible light follower robot by nagaraju.mNagaraju Medara
 
LED CUBE PROJECT.pptx
LED CUBE PROJECT.pptxLED CUBE PROJECT.pptx
LED CUBE PROJECT.pptxromairshad1
 
Ardu sat (Arduino based satellite)
Ardu sat (Arduino based satellite)Ardu sat (Arduino based satellite)
Ardu sat (Arduino based satellite)Barira Khan
 
Digital clock workshop
Digital clock workshopDigital clock workshop
Digital clock workshopKedarv
 
Arduino Programming for Basic Robotics - University of Moratuwa
Arduino Programming for Basic Robotics - University of MoratuwaArduino Programming for Basic Robotics - University of Moratuwa
Arduino Programming for Basic Robotics - University of MoratuwaAbarajithan Gnaneswaran
 
Lab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfLab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfssuser0e9cc4
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfAbdErrezakChahoub
 
T 000118--digital ic-tester
T 000118--digital ic-testerT 000118--digital ic-tester
T 000118--digital ic-testerRohanRonak
 

Similar to Arduino tutorial #2 (20)

Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
Internet of thing: Trabajando con Arduino y Visual Studio
Internet of thing: Trabajando con Arduino y Visual StudioInternet of thing: Trabajando con Arduino y Visual Studio
Internet of thing: Trabajando con Arduino y Visual Studio
 
Experimentdsd[1]
Experimentdsd[1]Experimentdsd[1]
Experimentdsd[1]
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
Wifi ac light dimmer
Wifi ac light dimmerWifi ac light dimmer
Wifi ac light dimmer
 
Prižiganje lučk z Arduinom
Prižiganje lučk z ArduinomPrižiganje lučk z Arduinom
Prižiganje lučk z Arduinom
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and Operation
 
IO kids
IO kidsIO kids
IO kids
 
visible light follower robot by nagaraju.m
visible light follower robot by nagaraju.mvisible light follower robot by nagaraju.m
visible light follower robot by nagaraju.m
 
Manual fsr'14
Manual fsr'14Manual fsr'14
Manual fsr'14
 
LED CUBE PROJECT.pptx
LED CUBE PROJECT.pptxLED CUBE PROJECT.pptx
LED CUBE PROJECT.pptx
 
Obstacle avoiding robot(Lab report)
Obstacle  avoiding  robot(Lab report)Obstacle  avoiding  robot(Lab report)
Obstacle avoiding robot(Lab report)
 
Microcontroller project
Microcontroller projectMicrocontroller project
Microcontroller project
 
Ardu sat (Arduino based satellite)
Ardu sat (Arduino based satellite)Ardu sat (Arduino based satellite)
Ardu sat (Arduino based satellite)
 
Digital clock workshop
Digital clock workshopDigital clock workshop
Digital clock workshop
 
Arduino Programming for Basic Robotics - University of Moratuwa
Arduino Programming for Basic Robotics - University of MoratuwaArduino Programming for Basic Robotics - University of Moratuwa
Arduino Programming for Basic Robotics - University of Moratuwa
 
Lab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfLab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdf
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdf
 
Ardui no
Ardui no Ardui no
Ardui no
 
T 000118--digital ic-tester
T 000118--digital ic-testerT 000118--digital ic-tester
T 000118--digital ic-tester
 

More from 동호 손

Raspberry pi tutorial #3
Raspberry pi tutorial #3Raspberry pi tutorial #3
Raspberry pi tutorial #3동호 손
 
Raspberry pi tutorial #2
Raspberry pi tutorial #2Raspberry pi tutorial #2
Raspberry pi tutorial #2동호 손
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started동호 손
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pi동호 손
 
Arduino tutorial #4
Arduino tutorial #4Arduino tutorial #4
Arduino tutorial #4동호 손
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started동호 손
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino동호 손
 
OpenVirtex (OVX) Tutorial
OpenVirtex (OVX) TutorialOpenVirtex (OVX) Tutorial
OpenVirtex (OVX) Tutorial동호 손
 

More from 동호 손 (8)

Raspberry pi tutorial #3
Raspberry pi tutorial #3Raspberry pi tutorial #3
Raspberry pi tutorial #3
 
Raspberry pi tutorial #2
Raspberry pi tutorial #2Raspberry pi tutorial #2
Raspberry pi tutorial #2
 
Raspberry pi : how to get started
Raspberry pi : how to get startedRaspberry pi : how to get started
Raspberry pi : how to get started
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pi
 
Arduino tutorial #4
Arduino tutorial #4Arduino tutorial #4
Arduino tutorial #4
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
OpenVirtex (OVX) Tutorial
OpenVirtex (OVX) TutorialOpenVirtex (OVX) Tutorial
OpenVirtex (OVX) Tutorial
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 

Arduino tutorial #2

  • 1. 1 Arduino Tutorial #2 - Blink the built-in LED & Control the external LED - Dong Ho Son POSTECH Pohang, Korea donghoson@postech.ac.kr
  • 2. 2 Blink the built-in LED - Overview  Let’s blink the LED • Simple code • Turn on the built-in LED − Built-in LED for test − Internally connected to digital pin #13 Source: pixabay.com/photo-2168193
  • 3. 3 Blink the built-in LED - Sketch  setup() { } • pinMode(13, OUTPUT); − Prepare the mode of pin − We will use pin #13 − We will order to LED  OUTPUT  loop() { } • digitalWrite(13, HIGH); − Turn on the built-in LED • Delay(1000); − Need 1 sec (1000ms) to check step-by-step • digitalWrite(13, LOW); − Turn off the built-in LED
  • 4. 4 Blink the built-in LED - Result  Built-in LED blinks! LED OFF!LED ON! Source: pixabay.com/photo-2168193
  • 5. 5 Control external LED - Overview  Jumper cables • Pin #2  Breadboard • Breadboard  GND (Ground)  LED • Longer lead (Positive)  Pin #2 • Shorter lead (Negative)  Resistor  Resistor • Necessary to protect the LED  Breadboard • Power rails − The top and bottom rows of holes are connected horizontally • Terminal strips − Remaining holes are connected vertically Positive Negative Power rails Terminal strips Source: pixabay
  • 6. 6 Control external LED – Circuit  Configure the circuit • Jumper cables • LED • Resistor (220 Ohm) • Breadboard +- Source: pixabay.com/photo-2168193
  • 7. 7 Control external LED - Sketch  setup() { } • pinMode(2, OUTPUT); − Prepare the mode of pin − We will use pin #2 − We will order to LED  OUTPUT  loop() { } • digitalWrite(2, HIGH); − Turn on the built-in LED • Delay(500); − Need 0.5 sec (500ms) to check step-by-step • digitalWrite(2, LOW); − Turn off the built-in LED
  • 8. 8 Control the external LED - Result  External LED blinks! +- Source: pixabay.com/photo-2168193
  • 9. 9 How to Use a Breadboard  If you are not familiar with how to use a breadboard, please take a look at the following tutorial on how to use a breadboard https://www.sciencebuddies.org/science-fair-projects/references/how- to-use-a-breadboard  Watch the video first