forked from yazgoo/minitel_twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminitel.cpp
46 lines (46 loc) · 787 Bytes
/
minitel.cpp
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
#include "Arduino.h"
#include <SoftwareSerial.h>
#include "Minitel.cpp"
Minitel* m;
void setup() {
m = new Minitel(6,7);
Serial.begin(1200);
}
void demoText() {
m->clearScreen();
m->mode(TEXT_MODE);
m->textColor(WHITE);
m->bgColor(BLACK);
m->blink();
m->noBlink();
int width = 35;
int i = 1;
int j = 0;
char text[2];
while(true)
{
if(Serial.available())
{
text[0] = Serial.read();
if(text[0] == '\n')
{
j++;
i = 1;
}
else
{
text[1] = 0;
m->text(text, i++, 1 + j);
if(i > width )
{
j++;
i = 1;
}
}
}
}
}
void loop()
{
demoText();
}