Display_Avr_3/пример с библиотеками ардуино.txt
2023-05-11 08:24:30 +00:00

56 lines
1.2 KiB
Plaintext

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(32, 16, 2);
byte MasArray[32] = {
78, 69, 71, 82, 32, 77, 65, 78, 68, 65, 82, 73, 78, 33, 33, 33,
32, 32, 32, 32, 46, 32, 32, 32, 32, 46, 32, 32, 32, 46, 37, 33
};
char colum1[17];
char colum2[17];
unsigned long previousTime = 0;
const unsigned long interval = 200;
void delay_ms(unsigned long milliseconds) {
unsigned long startTime = millis();
while (millis() - startTime < milliseconds) {
// Wait until the specified time has passed
}
}
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
for (int i = 0; i < 32; i++) {
if (i < 16) {
colum1[i] = (char)MasArray[i];
} else {
colum2[i - 16] = (char)MasArray[i];
}
}
colum1[16] = '\0';
colum2[16] = '\0';
}
void loop() {
unsigned long currentTime = millis();
if (currentTime - previousTime >= interval) {
previousTime = currentTime;
for (int i = 15; i > 0; i--) {
lcd.setCursor(i, 0);
lcd.print(colum1);
lcd.setCursor(0, 1);
lcd.print(colum2);
delay_ms(200); // Use the custom delay_ms() function instead of delay()
lcd.clear();
}
}
}