-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy nd paste me to arduino for upload
64 lines (40 loc) · 1.25 KB
/
copy nd paste me to arduino for upload
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//inspo from https://docs.arduino.cc/learn/electronics/lcd-displays#set-cursor-example
//takes serial input and scrolls it the screen as you type :)
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
}
void loop() {
lcd.autoscroll();
// 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());
}
lcd.setCursor(16, 2);
// set the display to automatically scroll:
lcd.autoscroll();
// print from 0 to 9:
for (int thisChar = 0; thisChar < 100; thisChar++) {
lcd.print(" ");
delay(500);
}
lcd.noAutoscroll();
// clear screen for the next loop:
lcd.clear();
}
}