mirror of
https://github.com/DinoMalin/paranoia-1.0.git
synced 2025-10-29 19:05:59 +00:00
feat: repeat emotions
This commit is contained in:
parent
224ceac38d
commit
ab5c764fba
@ -4,6 +4,8 @@
|
||||
hd44780_I2Cexp lcd; // auto-detects the I2C address
|
||||
LCD _lcd(&lcd);
|
||||
Face face(_lcd);
|
||||
char last = 0;
|
||||
|
||||
|
||||
void setup() {
|
||||
lcd.begin(16, 2);
|
||||
@ -22,18 +24,26 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
char last = 0;
|
||||
if (Serial.available() > 0) {
|
||||
char c = Serial.read();
|
||||
|
||||
if (c != last && c >= '0' && c <= '5')
|
||||
lcd.clear();
|
||||
if (c <= '0' || c >= '5') // repeat
|
||||
c = last;
|
||||
else
|
||||
last = c;
|
||||
|
||||
if (c == '1') {
|
||||
face.drawEyes();
|
||||
} else if (c == '2') {
|
||||
lcd.clear();
|
||||
face.blink();
|
||||
delay(300);
|
||||
face.drawEyes();
|
||||
delay(800);
|
||||
} else if (c == '3') {
|
||||
lcd.clear();
|
||||
face.drawLeftSideEye();
|
||||
delay(500);
|
||||
lcd.clear();
|
||||
@ -42,6 +52,7 @@ void loop() {
|
||||
lcd.clear();
|
||||
face.defaultPos();
|
||||
face.drawEyes();
|
||||
delay(800);
|
||||
} else if (c == '4') {
|
||||
face.drawAngry();
|
||||
} else if (c == '5') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user