From the course: Learning Arduino: Foundations
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
digitalWrite() - Arduino Tutorial
From the course: Learning Arduino: Foundations
digitalWrite()
- All right, 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 configured 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 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 you 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…
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.
Contents
-
-
-
-
(Locked)
Download the Arduino software39s
-
(Locked)
A tour of the Arduino IDE4m 1s
-
(Locked)
The setup() and loop() functions1m 17s
-
(Locked)
pinMode()2m 11s
-
(Locked)
digitalWrite()1m 33s
-
(Locked)
Creating your first sketch3m 32s
-
(Locked)
Serial Monitor1m 52s
-
(Locked)
Testing blink LED and Serial Monitor2m 32s
-
(Locked)
-
-
-