Arduino Tutorial for Beginners - Digital Output

Introduction: Arduino Tutorial for Beginners - Digital Output

About: As and electronics engineer I am amazed at how gadets work. Having experience in PIC programming using low level assembly language, I am very impressed at the Arduino platform and how quick and simple it is ...

In today’s instructable - "Arduino tutorial for beginners" , we explore the
digital output of a microcontroller. We expand on the built-in "blink" code example to output data to a pin.

We use the command digitalwrite and light up an external LED which creates a much more dramatic show than the onboard surface mounted LED.

Components Required

The components we need for this tutorial are:

  • Arduino Uno (or compatible board)
  • 220 ohm resistor
  • Super bright Red LED
  • Hookup wire
  • Computer with Arduino IDE installed and USB cable

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wiring Up the Project

Before we start writing the code we wire up the circuit which is just a single LED with a current limiting resistor. The LED we are using is a super bright red LED that has an operating voltage of 2V and draws 15mA. The resistor value is 220 ohm which is needed to limit the current to the LED to prevent it from being damaged.

A calculation example to work out the resistor value can be found in our blog post “simple LED driver circuit” .
We use an external prototyping board to wire up the circuit as in the image above. Remembering the longest lead on the LED connects to the positive side of the circuit and the shorter lead connects to the negative side of the circuit.

Step 2: Programming the Microcontroller

Once the circuit is wired up we start coding by setting up pin 2 to be an output pin, then later in the code we can make the pin either high or low. We use a loop and blink the LED 4 times in a row using a delay of 70 milliseconds between the high and low states.

The code for this tutorial is available from here.

Using the digital output is achieved simply by setting the pin direction to be an output and then using the digitalwrite command to make the output high or low.

I hope this Tutorial has been useful to you. If you liked it please share it with a friend.

Also, I'd really appreciate it for you to join my email subscriber list where we'll keep you up to date with our latest videos, tutorials and articles relating to microcontrollers, Arduino and other electronics information. You'll also receive our free newsletter which is exclusive to our email subscribers only !

Click Here to Subscriber Now !

Thanks for spending your time to read this Instructable. I really appreciate it !

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    2 Discussions


    Reply 3 years ago

    Thanks for letting me know.