Skip to content

Instantly share code, notes, and snippets.

@vampjaz
Last active December 20, 2015 22:29
Show Gist options
  • Save vampjaz/6205329 to your computer and use it in GitHub Desktop.
Save vampjaz/6205329 to your computer and use it in GitHub Desktop.
A simple Arduino script to display the Sparkfun logo and SparkFun!! on a HD44780 LCD screen. See https://lh6.googleusercontent.com/_L0Eke9UQNQJukJq1SFx7ZevKHVCGhQ6FiI92qOs1yMNd-CIVs9OLxAx1cneC-sp1g=s400 for a picture
/*
The Sparkfun logo is intellectual property of Sparkfun Inc.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K potentiometer:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
* 10K poterntiometer on pin A0
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// make some custom characters:
byte sfe1[] = {0x01,0x03,0x03,0x01,0x04,0x08,0x1D,0x1F};
byte sfe2[] = {0x18,0x14,0x10,0x1A,0x1E,0x1F,0x1F,0x1F};
byte sfe3[] = {0x1F,0x1F,0x1F,0x1F,0x1F,0x1C,0x18,0x10};
byte sfe4[] = {0x1F,0x1E,0x1E,0x1C,0x10,0x00,0x00,0x00};
void setup() {
// create a new character
lcd.createChar(0, sfe1);
// create a new character
lcd.createChar(1, sfe2);
// create a new character
lcd.createChar(2, sfe3);
// create a new character
lcd.createChar(3, sfe4);
// set up the lcd's number of columns and rows:
lcd.begin(8, 2);
lcd.write(byte(0));
lcd.write(byte(1));
lcd.print(" Spark");
lcd.setCursor(0,1);
lcd.write(byte(2));
lcd.write(byte(3));
lcd.print(" Fun!!");
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment