From the course: Learning Arduino: Interfacing with Hardware

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Cycle through each LED directly

Cycle through each LED directly - Arduino Tutorial

From the course: Learning Arduino: Interfacing with Hardware

Start my 1-month free trial

Cycle through each LED directly

- [Instructor] Okay, so the very first thing when we do the coding for the seven segment LED is to identify the pins. So I'll go ahead and start the Pin A. So in the Pin A I'll add it as a constant integer. And then I'll name it as ledPinA, and this one is connected to Pin 2 in the Arduino board. I'll do the same thing for the other pin, so constant integer ledPinB, and it's connected to Pin 3 in the Arduino board. So I'm going to go ahead and copy the other pins. So C is connected to 4. D is connected to 5. E to 6. G to 7. And finally, F to 8. So here we've identified what are the pins that's connected to each one of the LED. The second step is setting up the pins to be an output. So we do this in the void setup by setting up the pinMode. So now since we have identified the pins at the beginning, so I can just go ahead and write down the name for Pin 2. And then I identify this as an OUTPUT. So I'll do the same…

Contents