In this video, Zahraa uses the software to activate an LED using pushbutton using the digitalRead() function for the pushbutton and digitalWrite() function for the LED.
- [Instructor] So I'm still working on the same file…but this time, I want to add an LED…so every time we press on the pushbutton,…an LED turns on.…So I'll go ahead and add the LED to the circuit.…So I'm keeping the same arrangements for the pushbutton.…I'm going to go ahead and add the LED to the circuit.…So I'm doing the same arrangement…that I did last time,…connect one side to ground,…so I'm using the same common ground over here.…
The other side of the pushbutton goes to our resistor.…And I'm using 330 ohm.…And then finally, I'm going to connect that to Arduino…and I'll choose pin number three.…So now the first thing that we need to do is we need…to identify the LED pin.…So integer, and I'll give it a name,…and the pin that we selected is pin number three.…
Now in the void setup function,…I need to set the LED as an output.…So I use pinMode function…and then the LED,…and this time it's an output.…Now in the void loop function,…since I want the LED to turn on only…when the pushbutton is being pressed,…so I need to add the digitalWrite function…
- 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.