Playback starts YouTube’s embedded player (privacy-enhanced mode).
Tutorial 06: How to Blink an LED: Arduino Course for Absolute Beginners (ReM)
ChannelProgramming Electronics AcademyDescription from the creator
🤩 Get the 10 Arduino Programming Tips PDF here: 👇👇
bit.ly/3Kr5X9h
***If you like this, I think you'll like the premium Arduino training we offer. Check it out here*** bit.ly/3nSBPUs
We designed this circuit board for beginners!
Kit-On-A-Shield: amzn.to/3lfWClU
SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------
We use Rev Captions for our subtitles
bit.ly/39trLeB
Arduino UNO R3:
Amazon: amzn.to/37eP4ra
Newegg: bit.ly/3fahas8
Budget Arduino Kits:
Amazon:amzn.to/3C0VqsH
Newegg:bit.ly/3j4tISX
Multimeter Options:
Amazon: amzn.to/3rRo3E0
Newegg: bit.ly/3rJoekA
Helping Hands:
Amazon: amzn.to/3C8IYXZ
Newegg: bit.ly/3fb03X1
Soldering Stations:
Amazon: amzn.to/2VawmP4
Newegg: bit.ly/3BZ6oio
AFFILIATES & REFERRALS
---------------------------------------------------
►Audible Plus Free trial: amzn.to/3j5IGrV
►Join Honey- Save Money bit.ly/3xmj7rH
►Download Glasswire for Free:bit.ly/3iv1fql
FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook: facebook.com/ProgrammingElectronicsAcademy/
Twitter: twitter.com/ProgElecAcademy
Website: programmingelectronics.com/
*Click Below to Read About This Topic on Our Website*
programmingelectronics.com/tutorial-6-blink-an-…
*Description:*
The first program you usually write when learning a new programming language is called "Hello World". The program outputs those words as its only function. When learning to program micro-controllers such as the Arduino, the equivalent of "Hello World" is a program that blinks an LED. Guess what it is called - Blink.
You Will Need:
1 LED (any color works fine)
A 220 Ohm Resistor
An alligator clip (not essential but makes the circuit easier)
Fourteen small and smooth rocks from the a western pacific island (not essential but adds an esoteric feel)
NOTE: On most Arduino boards there is an LED soldered right by pin 13 - it is actually connected to pin 13 - so if you do not have an LED laying around (or a resistor for that matter), you can use the board mounted LED - it will blink with the same sketch.
Step-by-Step Instructions
Insert the short leg of the LED into the pin labeled GND on your Arduino.
Connect the 220 Ohm resistor to pin 13 on the Arduino. It doesn't matter which way you connect the resistor.
Now use the alligator clip to connect the long leg of the LED to the other leg of the resistor. If you do not have an alligator clip, you can twist the two leads together as best as you can to get a steady electrical connection.
Plug your Arduino board into your computer with a USB cable.
Open up the Arduino IDE.
Go to File, Examples , 01.Basics, Blink
Click the verify button on the top left. It should turn orange and then back to blue.
Click the upload button. It will also turn orange and then blue once the sketch has finished uploading to your Arduino board.
Now monitor you Arduino board - the LED should be blinking.
Make sure to read the comments at the top. Note the use of the multi-line comments syntax /* */. It is always a good idea to take time and see what the programmer has to say about the sketch they have written. She will likely be terse about how the program works or what it is supposed to accomplish. She might tell you how to set up the circuit.
The first block of code you come to after the description is where they initialize and declare variables. Here there is only one variable - and it gets declared and initialized on the same line.
int led = 13; //declare and initialize a variable with a single statement
You should be familiar with this from the last tutorial on variables. All we have done is made a variable and named it "led". This variable will hold integers and we put the value 13 into the variable. If this seems confusing, it might not hurt to review the last tutorial on variables - or you can voyage on - your call.
The next block of code you encounter in the Blink sketch is...
void setup()
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Recall that the setup() function will be in almost every Arduino sketch that you encounter. Inside the curly braces is code that will only be run once by your Arduino. For this program we see the function pinMode() is being used.
Let me start by saying that pinMode() is a wonderful function. If you recall, functions can take arguments. The pinMode() function takes two arguments - it wants to know which pin you are going to assign a mode to, and what mode you want that pin to be. The pin number is easy, 0-13 for any of the digital pins, and A0 through A5 for any of the analog pins.
The mode is an easy designation also - you are going to want the pin to be an INPUT - good for reading a sensor. Or an OUTPUT - good for powering an LED.
bit.ly/3Kr5X9h
***If you like this, I think you'll like the premium Arduino training we offer. Check it out here*** bit.ly/3nSBPUs
We designed this circuit board for beginners!
Kit-On-A-Shield: amzn.to/3lfWClU
SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------
We use Rev Captions for our subtitles
bit.ly/39trLeB
Arduino UNO R3:
Amazon: amzn.to/37eP4ra
Newegg: bit.ly/3fahas8
Budget Arduino Kits:
Amazon:amzn.to/3C0VqsH
Newegg:bit.ly/3j4tISX
Multimeter Options:
Amazon: amzn.to/3rRo3E0
Newegg: bit.ly/3rJoekA
Helping Hands:
Amazon: amzn.to/3C8IYXZ
Newegg: bit.ly/3fb03X1
Soldering Stations:
Amazon: amzn.to/2VawmP4
Newegg: bit.ly/3BZ6oio
AFFILIATES & REFERRALS
---------------------------------------------------
►Audible Plus Free trial: amzn.to/3j5IGrV
►Join Honey- Save Money bit.ly/3xmj7rH
►Download Glasswire for Free:bit.ly/3iv1fql
FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook: facebook.com/ProgrammingElectronicsAcademy/
Twitter: twitter.com/ProgElecAcademy
Website: programmingelectronics.com/
*Click Below to Read About This Topic on Our Website*
programmingelectronics.com/tutorial-6-blink-an-…
*Description:*
The first program you usually write when learning a new programming language is called "Hello World". The program outputs those words as its only function. When learning to program micro-controllers such as the Arduino, the equivalent of "Hello World" is a program that blinks an LED. Guess what it is called - Blink.
You Will Need:
1 LED (any color works fine)
A 220 Ohm Resistor
An alligator clip (not essential but makes the circuit easier)
Fourteen small and smooth rocks from the a western pacific island (not essential but adds an esoteric feel)
NOTE: On most Arduino boards there is an LED soldered right by pin 13 - it is actually connected to pin 13 - so if you do not have an LED laying around (or a resistor for that matter), you can use the board mounted LED - it will blink with the same sketch.
Step-by-Step Instructions
Insert the short leg of the LED into the pin labeled GND on your Arduino.
Connect the 220 Ohm resistor to pin 13 on the Arduino. It doesn't matter which way you connect the resistor.
Now use the alligator clip to connect the long leg of the LED to the other leg of the resistor. If you do not have an alligator clip, you can twist the two leads together as best as you can to get a steady electrical connection.
Plug your Arduino board into your computer with a USB cable.
Open up the Arduino IDE.
Go to File, Examples , 01.Basics, Blink
Click the verify button on the top left. It should turn orange and then back to blue.
Click the upload button. It will also turn orange and then blue once the sketch has finished uploading to your Arduino board.
Now monitor you Arduino board - the LED should be blinking.
Make sure to read the comments at the top. Note the use of the multi-line comments syntax /* */. It is always a good idea to take time and see what the programmer has to say about the sketch they have written. She will likely be terse about how the program works or what it is supposed to accomplish. She might tell you how to set up the circuit.
The first block of code you come to after the description is where they initialize and declare variables. Here there is only one variable - and it gets declared and initialized on the same line.
int led = 13; //declare and initialize a variable with a single statement
You should be familiar with this from the last tutorial on variables. All we have done is made a variable and named it "led". This variable will hold integers and we put the value 13 into the variable. If this seems confusing, it might not hurt to review the last tutorial on variables - or you can voyage on - your call.
The next block of code you encounter in the Blink sketch is...
void setup()
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Recall that the setup() function will be in almost every Arduino sketch that you encounter. Inside the curly braces is code that will only be run once by your Arduino. For this program we see the function pinMode() is being used.
Let me start by saying that pinMode() is a wonderful function. If you recall, functions can take arguments. The pinMode() function takes two arguments - it wants to know which pin you are going to assign a mode to, and what mode you want that pin to be. The pin number is easy, 0-13 for any of the digital pins, and A0 through A5 for any of the analog pins.
The mode is an easy designation also - you are going to want the pin to be an INPUT - good for reading a sensor. Or an OUTPUT - good for powering an LED.
About this tutorial
Programming Electronics Academy published this 14:39 video tutorial on November 1, 2013. It has been watched 313,038 times on YouTube.
- Category
- Science & Technology
- Duration
- 14:39
- Published
- November 1, 2013
- Views
- 313,038
- Likes
- 2,609
Tags
Share
This tutorial in other languages
- FRTutoriel 06: Comment faire clignoter une LED: Arduino Cours pour les débutants absolus (ReM)
- ESTutorial 06: Cómo abrir y cerrar de LED: Curso de Arduino para principiantes absolutos (REM)
- PTTutorial 06: Como piscar um LED: Curso Arduino para Absolute Beginners (REM)
- ITTutorial 06: come Blink un LED: Corso di Arduino per principianti assoluti (REM)
- DETutorial 06: Wie ein LED-Blink: Arduino-Kurs für absolute Anfänger (rem)
- NLTutorial 06: Hoe een LED Blink: Arduino cursus voor absolute beginners (REM)
- RUУчебник 06: Как Blink светодиодный: Arduino курса для абсолютных новичков (РЗМ)
- PLTutorial 06: Jak to Blink LED: Arduino kurs dla początkujących (REM)
- JAチュートリアル06:絶対初心者のためのArduinoコース(REM):LEDを点滅させる方法
- ARالبرنامج التعليمي 06: كيفية الطرفة والصمام: دورة اردوينو للمبتدئين المطلقة (REM)
- HIट्यूटोरियल 06: एक एलईडी ब्लिंक कैसे: निरपेक्ष शुरुआती के लिए Arduino कोर्स (REM)
- IDTutorial 06: Cara Blink LED: Arduino Course untuk Absolute Beginners (REM)