In this video, Zahraa explains the digitalWrite() function that outputs a value on the digital pin and gives an example of how to write the function.
- [Instructor] Alright, so the second…function that we are going to use is digitalWrite.…We use it if the digital pin has been configured…as an output using a pin mode.…The digitalWrite function outputs…a value on that specific pin.…So this is the way that we write the function.…digitalWrite, pin, and the value.…The pin is for the configure a pin…that we want to specify, and the value…is high or low.…
So if we take the same example,…the same previous example with the LED,…now if we want to turn on the LED,…we send high value.…So digitalWrite on pin two and then high.…Now if we want to turn it off,…we send a low value.…We write the digitalWrite function…inside the void loop function.…So the way to write it is digitalWrite,…and notice here that the color changes to orange,…indicating that the function is correct.…
And then the first parameter is the pin,…which is again we're using pin two.…And then finally sending, if I wanted…to turn it on, sending high.…And notice that the color changes to blue-greenish as well.…And then closing the function, and then finishing the line.…
- 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: Interfacing with Hardwarewith Zahraa Khalil1h 40m Intermediate
Learning Arduino: Pulse Width Modulationwith Rae Hoyt1h 16m 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.