Tutorial 06: How to Blink an LED: Arduino Course for Absolute Beginners (ReM)

preview_player
Показать описание
🤩 FREE Arduino Crash Course 👇👇

We designed this circuit board for beginners!

SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------

We use Rev Captions for our subtitles

Arduino UNO R3:

Budget Arduino Kits:

Multimeter Options:

Helping Hands:

Soldering Stations:

AFFILIATES & REFERRALS
---------------------------------------------------

FOLLOW US ELSEWHERE
---------------------------------------------------

*Click Below to Read About This Topic on Our Website*

*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.
Рекомендации по теме
Комментарии
Автор

" This course is not to build my project ideas but enabling you to build your awesome project ideas"

feeling

 awesome lessons. thanks a million. 

traktap
Автор

the perfect space for learning arduino.. hats off man.. take a bow..

dipanjansingha
Автор

Bought an Arduino starter kit about 18 months ago, tried following some of the books. Your tutorials are much superior to them. Thank you for this.

thomasverga
Автор

LOL @ the reference for remembering which is the cathode. Totally using this now.

dan
Автор

I really can't thank you enough! My son wants to learn arduino, and I've been reading books and projects tutorials and have been sooo lost. I feel like for the first time all that gibberish is starting to make sense.

ygpsk
Автор

You should do a tutorial on how to make a tutorial, then send it to my old Fortran professor.

baysidemeef
Автор

by saying that change the number of the led variable to 12and adjust the resistor what do u mean like putting the resistor on pin 12 and not on

arjunkohlimagic
Автор

from all tge videos on youtube after spend plenty of gigs i found the perfect channel .thx for making these cool tutorial .I just wanna tell you thar you've educate a boy from Indonesia and that boy is thanking you so much to this channel creator

__MKhalil_Razan_Faza
Автор

At first I thought your presentations were too simple and too slow. Now I see they are clear, exact, and just what I need to know what I am doing with Arduino. Heretofore I have thought of the coding as cryptic and opaque. Thanks a lot; well done.

robertpendergast
Автор

Your teaching style is allowing me understand the syntax and concepts of writing code. Its amazing to me how easy and simple you make it sound. You Rock Dude!

timothyrehfeldt
Автор

I am new to Arduino....and this 7 years old tutorial is helping me a lot ! Thanks a ton !

chetanbora
Автор

You are the best tutor that I have seen in YouTube so far. Keep up the good work!

lalinduweerakkody
Автор

this was so great for me. especially this video about learning the 3 basic blocks of code thats necessary

corywilliamsmith
Автор

I am new to arduino and this is by far the best explanation and tutorial I have come across. You gained a sub.

rosshudgins
Автор

I'm new at this and i must tell you, by far your videos are the BEST. God bless, keep up the good work.

simonm
Автор

Your're so great, I was looking for someone who can explain as like you. I understand everything what you said more than my professor .Thnx very much man :)

taimalzammar
Автор

thank so much i was really having a hard time this tutorial helped me a lot i was told to do this tutorial as a homework i had no idea how to do it thank you

youmnaboutanes
Автор

Hey there, thanks for the tutorials; they're great for someone such as myself with next to no C+ coding experience :)
Just wondering why you've used a resistor though?

richiegurdler
Автор

I just made a little sequence with 3 different pins. Illuminatig each one for one second back and forth. Your tutorials are really helpful!

woandersone
Автор

Thanks! You are really helping me out, I was looking for something like this! Now i'm understanding how it really works, you guys are the best!

tonylromo
visit shbcf.ru