Last active
November 11, 2017 23:16
-
-
Save fbelleau/3f7461d6b8e6cd9810a13e9afd036c0f to your computer and use it in GitHub Desktop.
i2c-lcd-serial
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
| // https://github.com/marcoschwartz/LiquidCrystal_I2C | |
| #include <Wire.h> | |
| #include <LiquidCrystal_I2C.h> | |
| LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display | |
| void setup() | |
| { | |
| lcd.init(); // initialize the lcd | |
| lcd.backlight(); | |
| Serial.begin(9600); | |
| } | |
| void loop() | |
| { | |
| // when characters arrive over the serial port... | |
| if (Serial.available()) { | |
| // wait a bit for the entire message to arrive | |
| delay(100); | |
| // clear the screen | |
| lcd.clear(); | |
| // read all the available characters | |
| while (Serial.available() > 0) { | |
| // display each character to the LCD | |
| lcd.write(Serial.read()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment