Join Zahraa Khalil for an in-depth discussion in this video Cycle through LEDs with a for loop, part of Learning Arduino: Interfacing with Hardware.
- So in the previous video,…we kind of copy and paste a lot of the code…so let's try to use a for loop in order to reduce the code…that we tried in the previous example.…Since we did the wiring for the Arduino board,…from two all the way to eight,…so we can take advantage of using a for loop…where we can start from two all the way to eight.…So let's see how we can do that in the coding parts.…So I'll give it a start in here.…On line 13 all the way to line 19,…the only thing that's being changed is the LED parts.…
So you notice here it's A, B, C, D.…So since we do the wiring from two all the way to eight,…so we can use a for loop.…So in the for loop, I'm going to go ahead…and initialize a starting point.…I'll name it equals to two because the pins…are connected from two.…And then I is less than nine…because I want the number to stop at eight.…And then finally the increment would be just one.…
Now inside the for loop, I write down the pin mode.…And then place i here, the one that keep changes,…and then add it as an output.…
- Interfacing with an LCD screen
- Wiring and coding the LCD interface
- Displaying random numbers on the LCD
- Interfacing with a seven-segment LED component
- Cycling through LEDs
- Using a shift register to interface with a seven-segment LED
- Interfacing with a keypad
- Combining the LCD, keypad, and LED
Skill Level Intermediate
The devices used38s
1. Interface with an LCD
2. Interface with a 7-Segment LED Directly
3. Interface with a 7-Segment LED Using a Shift Register
4. Interface with a Keypad
- 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.