Book Image

Intel Galileo Blueprints

By : Marco Schwartz
Book Image

Intel Galileo Blueprints

By: Marco Schwartz

Overview of this book

Table of Contents (19 chapters)
Intel Galileo Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Setting Up the Galileo Board and the Development Environment
Index

Testing the LCD screen


We are now ready to test the LCD screen. The following is the complete code that I've used to do so:

// Libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SD.h>
#include <Ethernet.h>

// LCD Screen
LiquidCrystal_I2C lcd(0x27,20,4);

void setup()
{
  // Initialize LCD screen
  initDisplay();
  
}

void loop()
{
  // Print message on the LCD screen
  lcd.setCursor(0,0);
  lcd.println("This is a test of the LCD screen!");
}

// Initialize LCD screen
void initDisplay()
{
  lcd.init();      
  lcd.backlight();
  lcd.clear();
}

Let's look at the code line by line:

The first part of the code includes the libraries that we need in order to carry out this project. The four libraries that you should include are Wire.h, LiquidCrystal_I2C.h, SD.h, and Ethernet.h:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SD.h>
#include <Ethernet.h>

Then, we declare the LCD instance. If you have used a different screen...