Page 85 - Programming the Photon Getting Started With the Internet of Things
P. 85
#include "LiquidCrystal/LiquidCrystal.h"
void setup() {
}
void loop() {
}
The rest of program is as follows:
#include "LiquidCrystal/LiquidCrystal.h"
LiquidCrystal lcd(D0, D1, D2, D3, D4, D5);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16,2);
lcd.clear();
// Print a message to the LCD.
lcd.print("Particle Photon");
//Move cursor to the second line
lcd.setCursor(0, 1);
lcd.print("Getting Started");
}
void loop() {
}
In this example you add some text to the display on the first and second lines of the
LCD display. This demonstrates how to initialize the display, how to write text, and how
to move the cursor. First include the LiquidCrystal library as previously mentioned:
#include "LiquidCrystal/LiquidCrystal.h"
Then initialize an LCD object as follows:
LiquidCrystal lcd(D0, D1, D2, D3, D4, D5);
The arguments for the LCD initialization represent the Photon pins connected to RS,
EN, D4, D5, D6, and D7 in that order. In the setup you call the library’s begin() function
to set up the LCD display with the character size. The arguments for this command
represent the number of columns and the number of rows: