Learn to code

ARDUINO & CODES

Previous Post
Using the map function for analog results with Arduino
Next Post
Connecting LEDs with Arduino

Introduction into visual output with Arduino

in Arduino Visual Output

Visual output lets you control LED devices. Before you can go in detail about Visual Output let us look first at two kind of outputs, digital and analog visual output. This introduction will be a good starting point if you are not yet familiar with using digital and analog outputs (digitalWrite and analogWrite).

Digital Output

All the pins on the Arduino Uno Board can be used for digital input can also be used for digital output. You can reread where the pins are in the tutotorial:  Arduino Tutorial: 1.1 The Arduino Board.

Digital output will cause the voltage on a pin to be either HIGH (5 volts) or LOW (0volts). You can use the command digitalWrite(outputPin, value) to turn something on or off. digitalWrite uses two parameters: outputPin is the pin you want to control and value can either be HIGH or LOW.

Remember, to be able to use digitalWrite you will need to set the pin that you are using as an ouput mode pinMode(outputPinm Output). The sketch in tutorial:  Arduino Tutorial: 2.1 Blink a LED   provides an example how to use digital output.

Analog Output

While digital ouput has two output modes, on or off, the output of analog can be gradually varied to a maximum level. Think of light dimmers or volume controls. You can use the analogWrite function to control things like the intensity of an LED such as we will do in tutorial: Arduino Tutorial: 5.2 Adjust the brightness of an LED with PWM. AnalogWrite uses a technique called Pulse Width Modulation (PWM) that emulates an analog signal using digtital puleses.

PWM works by varying the proportion of the pulse on time to off time. When the pulses are repeated quickly enough (almost 500 times per second on Arduino), the pulsing cannor be detected by human senses. 

Arduino has a limited number of pins that can be used for analog output. In the tutorial: Arduino Tutorial: 1.1 The Arduino Board, you can see which pins correspond to analog pins.

You can control light using digital or analog output. Thus, you can use the digitalWrite command for turning a LED on or off and analogWrite if you would like more control over the LED.

LED Specifications

An LED is a semiconductor device with two leads, an anode and a cathode. When the voltage on the anode is more positive than on the cathode the LED emits light. The anode is the longer lead and the other is the cathode lead. 

A typical LED has a voltage of around 1.8 volts. If the voltage on the anode is not 1.8 volts more positive than the cathode no current will flow through the LED and the LED will be off. When the voltage on the anode becomes 1.8 volts more positive than the cathode the LED will turn on. 

You need to limit the current with a resistor or the LED will soon or later burn out.

Arduino Pins can supply up to 40mA of current. This wil be enough for your LED, nut not enough to drive multiple LEDs connected to a single pin. If you want to increase the current through the LED you should use a transistor.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu