Chapter 3. Adding Display Functionality
In Chapter 2, Accessing the GPIO Pins, you learned how to connect to the Galileo and its GPIO pins using jumper wires, breadboards, and components. In this chapter, you'll learn more about adding functionality by adding hardware designed to plug into the Galileo. In some of these examples, you'll use special hardware designed to be plugged into the Galileo's GPIO pins; these are called shields.
The simple serial display
In order to understand how to use a shield, let's start with one of the most basic display modules available for the Galileo, the serial LCD display. There are several different versions out there, but most provide a simple 2 x 16 character display that can be driven by the serial TX pin on the Arduino. They are available at most locations where the Galileo is offered. The following image shows the display:
You'll need three pins to drive this display. They are a GND and VCC pin, and the TX pin. The VCC and GND will come from the 5V and GND pins on the Galileo. You'll use digital I/O pin 1 on the Galileo as a TX. To connect the Galileo to the display, connect the male to male jumpers to 5 Volts, GND, and digital input. Connect the three connectors to the proper connections on the board, like this:
This should complete the hardware connections to the board. Now you'll need some code to write characters to the board.
Enabling the serial display in the IDE
Now bring up...
Using a TFT display shield is another way of adding display capability to your Galileo. There is a limited set of TFT displays that will work with the Galileo and the performance isn't very fast, but it does work. First, you'll need a display, for example the Adafruit 2.8 inch TFT V2 available from adafruit.com. The following image shows the unit:
You'll place this shield onto the Galileo, like this:
The unit will light up and show that it is connected. Once the hardware is connected, you'll now need to access the display via the IDE.
Accessing the display with the IDE
To access the display, you'll need to follow these steps:
Go to the IDE libraries directory and delete the Robot_Control
library. This has some duplicate files that will cause problems later if you don't get rid of them.
Download the
Adafruit_GFX
library and install it in the IDE library. You can get this library at https://learn.adafruit.com/adafruit-gfx-graphics-library. You'll need to unzip it, change the name...
That's it. You've learned how to add display capability to your Galileo projects using shields. You'll use these same concepts in later chapters to add other types of functionalities. In fact in the next chapter, you'll use the shield concept to control DC motors.