#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define INLENGTH 20
#define INTERMINATOR 10
char inString[INLENGTH + 1];
int inCount;
LiquidCrystal_I2C lcd (0x27, 16, 2);
void setup() {
load();
}
void loop() {
inCount = 0;
do {
while (Serial.available() == 0);
inString [inCount] = Serial.read();
if (inString[inCount] == INTERMINATOR) break;
} while (++inCount < INLENGTH);
inString[inCount] = 0;
Serial.println(inString);
if (strcmp(inString, "Призвіще") == 0)
show_name();
else if (strcmp(inString, "Група") == 0)
show_group();
else
Serial.println("Unknown command");
}
void show_group()
{
byte g_UA[8] = {
0b00000,
0b11110,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b00000
};
byte p_UA[8] = {
0b00000,
0b00000,
0b11111,
0b10001,
0b10001,
0b10001,
0b10001,
0b00000
};
lcd.createChar(0, g_UA);
lcd.createChar(1, p_UA);
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(byte(0));
lcd.print("py");
lcd.write(byte(1));
lcd.print("a: IP - 31");
}
void show_name() {
byte B_ua[8] = {
0b00000,
0b00000,
0b11100,
0b10010,
0b11100,
0b10010,
0b11100,
0b00000
};
byte t_ua[8] = {
0b00000,
0b00000,
0b11111,
0b00100,
0b00100,
0b00100,
0b00100,
0b00000
};
byte U_ua[8] = {
0b00000,
0b00000,
0b10001,
0b10011,
0b10101,
0b11001,
0b10001,
0b00000
};
byte M_ua[8] = {
0b00000,
0b00000,
0b10001,
0b11011,
0b10101,
0b10001,
0b10001,
0b00000
};
lcd.createChar(0, t_ua);
lcd.createChar(1, B_ua);
lcd.createChar(2, U_ua);
lcd.createChar(3, M_ua);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print('K');
delay(55);
lcd.print("o");
delay(55);
lcd.write(byte(0));
delay(55);
lcd.print("o");
delay(55);
lcd.write(byte(1));
delay(55);
lcd.print(" M");
delay(55);
lcd.print("a");
delay(55);
lcd.print("k");
delay(55);
lcd.print("c");
delay(55);
lcd.write(byte(2));
delay(55);
lcd.write(byte(3));
}
void load()
{
byte load_char[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
lcd.init();
lcd.backlight ();
lcd.createChar(0, load_char);
lcd.clear();
lcd.setCursor(0,0);
for(int i = 0; i <= 16; i++)
{
lcd.setCursor(i,0);
lcd.write(byte(0));
lcd.setCursor(i,1);
lcd.write(byte(0));
delay(60);
}
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Arduino Serial");
lcd.setCursor(5,1);
lcd.print("Read");
Serial.begin(9600);
Serial.println("Введіть призвіще, для виводу призвіща та ім'я, або група, для виводу номера групи");
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL