-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputSerialToDisplay.ino
More file actions
45 lines (33 loc) · 966 Bytes
/
OutputSerialToDisplay.ino
File metadata and controls
45 lines (33 loc) · 966 Bytes
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
#include <MicroView.h>
String name;
void setup()
{
uView.begin(); // init and start MicroView
uView.clear(PAGE); // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
Serial.begin(9600);
uView.setFontType(1); // set font type 1
uView.setCursor(11,0); // points cursor to x=11 y=0
uView.print("_");
}
void loop()
{
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
char c = Serial.read();
if (c == '0') {
uView.clear(PAGE);
//print the name
uView.setCursor(11,0); // points cursor to x=11 y=0
uView.print("Hello");
uView.setCursor(11,16); // points cursor to x=11 y=16
uView.print(name);
Serial.print(name);
name = ""; // clear the name string
}
else {
name += c; // append the read char from Serial to the name string
}
}
uView.display();
delay(100);
}