From the course: Learning Arduino: Foundations
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Code to blink an LED - Arduino Tutorial
From the course: Learning Arduino: Foundations
Code to blink an LED
- All right, so now in order to program LED to turn it on and off for a certain time, we are going to use the same file that we did for LED 13. So go ahead and open the same file that we used for the serial monitor example. The file name is first sketch serial monitor. So now the very first thing, which is in line one, we need to change the LED instead of LED equal 13 to the pin that we're currently using, which is pin eight. So I'll go ahead and I'll change it to pin eight. So now I'll leave everything as it is. And this is one of the advantages of you declaring the variable at the beginning is that you only change one thing in the code. So I'll go ahead. I'll verify it and upload it to the Arduino. So now you can see the led is on for a second and all for half a second. Same as we did last time. The only difference is that we're using an external LED this time. Okay, so now let's try to do something a little bit fun…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.