In this video, Zahraa shows how to write code to turn on and off the LED using the digitalWrite() function by sending high and low signals to the digital pin. See how to use the delay command to achieve the flashing effect.
- [Instructor] All right, so now in order to program the 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 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 that the LED is on…for a second and off 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…this time, with the code.…
We're going to change the code a little bit…so the LED blinks faster and faster.…
- What's an Arduino?
- Creating an Arduino program
- Using the setup() and loop() functions
- Using the pinMode() and digitalWrite() commands
- Creating your first sketch
- Writing code to turn LEDs on and off
- Wiring a pushbutton to Arduino
- Activating an LED with a pushbutton
Skill Level Beginner
Learning Arduino: Pulse Width Modulationwith Rae Hoyt1h 16m Intermediate
Learning Arduino: Interfacing with Hardwarewith Zahraa Khalil1h 40m Intermediate
1. Introduction to Arduino
2. Creating an Arduino Program
3. Interface with Ouptut: LED
4. Interface with Input: Pushbutton
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.