Skip to content

Instantly share code, notes, and snippets.

@samueldotj
Last active December 22, 2015 14:58
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 samueldotj/6489019 to your computer and use it in GitHub Desktop.
Save samueldotj/6489019 to your computer and use it in GitHub Desktop.
Arduino Code for SainSmart IIC/I2C/TWI Serial 2004 20x4 LCD Module.
/*
* Sample code for SainSmart IIC/I2C/TWI Serial 2004 20x4 LCD Module.
* License: GPL
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x3F
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
#define BACKLIGHT_PIN 3
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin,
D4_pin, D5_pin, D6_pin, D7_pin);
void setup() {
lcd.begin (20, 4);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(LOW);
// Position cursor and write some text
lcd.home();
lcd.print("Hello World");
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment