Peripherals pt. 3 – Output



Make your Arduino switch your light on or off. No problem with a relay. It may be integrated into a simple wall plug.

A simple to use implementation of a relay class is the following header:

… and implementation (note that we now see how much work our base classes save us):


An LED indication sound simple, but is useful in a lot of different cases. You may cascade them with a shift register that saves you lots of output pins.
Using an LED is quite straight forward, we only use our generic digital IO class having defined a certain pin.


Fancy music with your Arduino? – No problem with a speaker. There are libraries and songs available all over the web – Super Mario? Star Wars? Knight Rider? – No problem.

LCD Display

Output a whole lot of text or measurement data? A menu navigatable by buttons? – No problem, all-ready libraries let you use different LCD displays without having to mess around with the technical details. However, you also may use advanced controls for more fancy stuff and individual ‘characters’ you like – e.g. Smileys.

7-segment display

Output of numbers – sounds easy – it is. A 7-segment device lets you turn on or off each part of a number. More advanced versions may also show even more characters.

Previous Part – Input here.

Leave a Reply