O'Reilly logo

Make a Mind-Controlled Arduino Robot by Kimmo Karvinen, Tero Karvinen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bells and Whistles

LEDs and piezo speakers create user interface for many embedded devices. Even though they are low-key compared to computer displays and big speakers, they serve an important function. Users expect to get feedback on what they are doing.

Using LEDs and speakers to describe program state also helps coding. It would be difficult to keep a moving robot continuously on a USB leash. Sounds and lights on the robot will tell you what’s happening, so you don’t have to divide your attention between the serial monitor and the device. And of course, you don’t have to fight with a lost serial connection.

Red, Green, and Blue LED

An RGB LED has three LEDs in one package (Figure 2-18). The colors of those LEDs are the primary colors: red, green, and blue (Figure 2-19). When you mix colors by turning on multiple LEDs, you get secondary colors such as cyan, magenta, and yellow.

An RGB LED has three LEDs in one package

Figure 2-18. An RGB LED has three LEDs in one package

RGB LED primary colors

Figure 2-19. RGB LED primary colors

The RGB LED you use in this project has one positive leg and three negative legs. This configuration is called common anode. The positive wire is always connected to Arduino’s +5V.

When your data pins (D9, D10, D11) are at +5V, there is no voltage difference between the LED’s legs. All the LEDs are off.

When you want to light ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required