The Arduino Academy - Lesson 2 - Basic Outputs





Introduction: The Arduino Academy - Lesson 2 - Basic Outputs

Lesson 2 of the Arduino Academy in which we will learn all about Basic Outputs on the Arduino.

If you have any questions then leave them in the comments and I will get back to you asap.

Don't forget to subscribe. You can follow me on Twitter @TheArduinoGuy and my blog is at

The Arduino Academy facebook group can be found at

Keep an eye out for Lesson 3 when we will learn about Basic Inputs on the Arduino.

Mike McRoberts



    • Spotless Contest

      Spotless Contest
    • Space Challenge

      Space Challenge
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.




    Suppose I wanted these leds to cycle only three times. I created a for loop that embedded the previous for loop within it, but it never stops. My code looks like this:

    void loop() {
    for (int reps = 1; reps < 4; reps = reps +1) {
    for (int led = 8; led < 11; led = led + 1) {

    // put your main code here, to run repeatedly:
    digitalWrite(led, HIGH);
    digitalWrite(led, LOW);

    Do I need to have an if loop that says if reps =4 'just stop repeating'. I see why it doesn't stop: it starts the outside loop, then the inside loop; outside loop is advanced until it gets to 4. But then the damn things does it again and again. I'd like a way to stop it.

    You have a loop that repeats 3 times inside a loop that repeats 3 times so the whole thing will run 9 times.

    Apart from that I see nothing wrong with the code. it shoudl stop after 3 cycles.

    I had a single for loop embedded in another and you said it should stop after 3 cycles but it didn't. So I tried just one for loop (5 iterations) and it didn't stop after 5. I don't get it.

    Sorry, massive bugbear of mine is when people paste code into comments. Please use the correct formatting or use Pastebin for code.

    HI. I have a bunch of LEDs but no data sheet to determine voltage drop (I assume what whatever you said is basically what I have. However, how could I determine the voltage drop without the data sheet? And how do you know tht the current is .03a (without some data sheet)?

    The easiest way is to sacrifice an LED or two and connect them up to a variable power supply and increase the voltage till it pops. At the same time, measure the current draw across the LED.

    I asked the question below because I am planning to use a vibratory motor for a project and I have no spec sheet on that either but I don't want it to burn out.

    By the way I really liked the way you presented this lesson.