-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserial_output_i2c_lcd.txt
41 lines (36 loc) · 1.13 KB
/
serial_output_i2c_lcd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ___ ___ ___ _ _ ___ ___ ____ ___ ____
* / _ \ /___)/ _ \| | | |/ _ \ / _ \ / ___) _ \| \
*| |_| |___ | |_| | |_| | |_| | |_| ( (__| |_| | | | |
* \___/(___/ \___/ \__ |\___/ \___(_)____)___/|_|_|_|
* (____/
* www.osoyoo.com IC2 Liquid Crysal Testing program
* program tutorial : http://osoyoo.com/?p=72
* Copyright John Yu
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f,16,2); // run ic2_scanner sketch and get the IC2 address, which is 0x3f in my case,it could be 0x3f in many cases
void setup()
{
Serial.begin(9600);
lcd.init(); // initialize the lcd
lcd.setCursor(0, 0);
lcd.backlight();
lcd.print("waiting input");
}
void loop()
{
String inData;
// set cursor to first line
while(Serial.available() > 0) // Don't read unless
{
inData = Serial.readString(); // Read a String
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(inData);
inData=inData + " displayed!";
Serial.print(inData);
}
}