Last active
January 16, 2019 03:00
-
-
Save amereservant/a75a43538b3457aa68e8 to your computer and use it in GitHub Desktop.
Demo code for IIC/I2C Serial Interface Adapter Module For 1602 LCD Display - mklec
This file contains hidden or 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
/** | |
* I2C/IIC LCD Serial Adapter Module Example | |
* Tutorial by http://mklec.com | |
* | |
* Instructions at http://blog.mklec.com/how-to-use-iici2c-serial-interface-module-for-1602-lcd-display | |
* | |
* This uses the Liquid Crystal library from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads GNU General Public License, version 3 (GPL-3.0) | |
* Pin Connections: | |
* SCL = A5 | |
* SDA = A4 | |
* VCC = 5V | |
* GND = GND | |
*/ | |
#include <Wire.h> | |
#include <LCD.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified module | |
void setup() | |
{ | |
lcd.setBacklightPin(3,POSITIVE); | |
lcd.setBacklight(HIGH); // NOTE: You can turn the backlight off by setting it to LOW instead of HIGH | |
lcd.begin(16, 2); | |
lcd.clear(); | |
} | |
void loop() | |
{ | |
lcd.setCursor(0,0); | |
lcd.print("http://mklec.com"); | |
lcd.setCursor(0,1); | |
lcd.print("I2C Module Demo"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment