Last active
December 22, 2015 14:58
-
-
Save samueldotj/6489019 to your computer and use it in GitHub Desktop.
Arduino Code for SainSmart IIC/I2C/TWI Serial 2004 20x4 LCD Module.
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
/* | |
* 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