Created
February 8, 2013 18:56
-
-
Save buildcircuit/4741110 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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