Skip to content

Instantly share code, notes, and snippets.

@buildcircuit
Created February 8, 2013 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buildcircuit/4741110 to your computer and use it in GitHub Desktop.
Save buildcircuit/4741110 to your computer and use it in GitHub Desktop.
// Example from Sparkfun.com
// Original page: http://www.sparkfun.com/tutorials/246
// Clear the display and say "Hello World!"
// This sketch is for Arduino versions 1.0 and later
// If you're using an Arduino version older than 1.0, use
// the other example code available on the tutorial page.
// Use the softwareserial library to create a new "soft" serial port
// for the display. This prevents display corruption when uploading code.
#include <SoftwareSerial.h>
// Attach the serial display's RX line to digital pin 2
SoftwareSerial mySerial(3,2); // pin 2 = TX, pin 3 = RX (unused)
void setup()
{
mySerial.begin(9600); // set up serial port for 9600 baud
delay(500); // wait for display to boot up
}
void loop()
{
mySerial.write(254); // move cursor to beginning of first line
mySerial.write(128);
mySerial.write(" "); // clear display
mySerial.write(" ");
mySerial.write(254); // move cursor to beginning of first line
mySerial.write(128);
mySerial.write("Hello, world!");
while(1); // wait forever
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment