здравствуйте еще раз!
моя новая хотелка, к которой хочется привязать скетч из предыдущего поста
исходный скетч
#include <LiquidCrystal.h>
#include <EEPROM.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);// RS,E,D4,D5,D6,D7
byte v1[8] = {0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111};
byte v2[8] = {0b00111, 0b00111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte v3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v4[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v5[8] = {0b11100, 0b11100, 0b00000, 0b00000, 0b00000, 0b00000, 0b11100, 0b11100};
byte v6[8] = {0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100};
byte v7[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00111, 0b00111};
byte v8[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
unsigned long times, times0, times1;
int sec, min, hour;
int min_alarm, hour_alarm;
int menu;
byte a[6], d1, d2, d3, d4, d5, d6, e1, e2, e3, x;
bool w, alarm;
void setup() {
lcd.begin(16, 2);// LCD 16X2
pinMode(6, INPUT_PULLUP); // кнопка коррекции
pinMode(5, INPUT_PULLUP); // кнопка +
pinMode(4, INPUT_PULLUP); // кнопка -
pinMode(3, OUTPUT); // выход для пъезоизлучателя
lcd.createChar(1, v1); lcd.createChar(2, v2); lcd.createChar(3, v3); lcd.createChar(4, v4);
lcd.createChar(5, v5); lcd.createChar(6, v6); lcd.createChar(7, v7); lcd.createChar(8, v8);
cli();
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;
// (16000000/((15624+1)x1024))=1 Hz
//OCR1A = 15624; // корректировка точности часов
//OCR1A = 15587;//предварительный расчет
OCR1A = 15587;
TCCR1B |= (1 << WGM12);
// Prescaler 1024
TCCR1B |= (1 << CS12) | (1 << CS10);
TIMSK1 |= (1 << OCIE1A);
sei();
if (EEPROM.read(100) != 0) {
for (int i = 0; i < 101; i++) {
EEPROM.update(i, 0); // очистка памяти при первом включении
}
}
hour_alarm = EEPROM.read(0); min_alarm = EEPROM.read(1); alarm = EEPROM.read(2);
}
void loop() {
if (millis() - times < 500) {
w = 1;
}
if (millis() - times >= 500 && millis() - times < 600) {
w = 0;
}
if (millis() - times > 600) {
times = millis();
}
if (digitalRead(6) == LOW) {
menu++;
lcd.clear();
if (menu > 4) {
menu = 0;
} delay(300);
}
if (menu == 0) {
if (digitalRead(4) == LOW && alarm == 0) {
lcd.clear();
alarm = 1;
times = millis();
w = 1;
lcd.setCursor(0, 0);
lcd.print(" ALARM ON ");
delay(1000);
}
if (digitalRead(4) == LOW && alarm == 1) {
lcd.clear();
alarm = 0;
times = millis();
w = 1;
lcd.setCursor(0, 0);
lcd.print(" ALARM OFF");
delay(1000);
}
if (digitalRead(5) == LOW) { //сброс секунд
sec = 0;
}
}
/////////////////// ЧАСЫ ///////////////////////////////////////////////////////////////////
if (menu == 0) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
/////////// мигание точек в режиме часы ////////////////////////////////
if (millis() - times1 > 900) {
lcd.setCursor(6, 0); lcd.print(" "); lcd.setCursor(6, 1); lcd.print(" ");
times1 = millis() ;
delay(100);
}
else {
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
}
////////////////////////////////////////////////////////////////////////////////////////
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
if (alarm == 0) {
lcd.setCursor(13, 0);
//lcd.print("off");
}
if (alarm == 1) {
lcd.setCursor(13, 0);
lcd.print(" on");
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
///// korr hour
if (menu == 1) {
if (digitalRead(5) == LOW) {
hour++;
if (hour > 23) {
hour = 23;
} delay(100);
}
if (digitalRead(4) == LOW) {
hour--;
if (hour < 0) {
hour = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
else {
a[0] = 10;
a[1] = 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
}
///// korr min
if (menu == 2) {
if (digitalRead(5) == LOW) {
min++;
if (min > 59) {
min = 59;
} delay(100);
}
if (digitalRead(4) == LOW) {
min--;
if (min < 0) {
min = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
else {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = 10;
a[3] = 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
}
///// korr hour alarm
if (menu == 3) {
if (digitalRead(5) == LOW) {
hour_alarm++;
times = millis();
w = 1;
if (hour_alarm > 23) {
hour_alarm = 23;
} delay(100);
}
if (digitalRead(4) == LOW) {
hour_alarm--;
times = millis();
w = 1;
if (hour_alarm < 0) {
hour_alarm = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
else {
a[0] = 10;
a[1] = 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(13, 0); lcd.print("KOR"); lcd.setCursor(13, 1); lcd.print("ALR");
}
///// korr min alarm
if (menu == 4) {
if (digitalRead(5) == LOW) {
min_alarm++;
times = millis();
w = 1;
if (min_alarm > 59) {
min_alarm = 59;
} delay(100);
}
if (digitalRead(4) == LOW) {
min_alarm--;
times = millis();
w = 1;
if (min_alarm < 0) {
min_alarm = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
else {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = 10;
a[3] = 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(13, 0); lcd.print("KOR"); lcd.setCursor(13, 1); lcd.print("ALR");
}
/// BUZZER
if (alarm == 1 && (hour * 100 + min == hour_alarm * 100 + min_alarm)) {
buzzer();
}
if (millis() - times > 10000 && w == 1) {
EEPROM.update(0, hour_alarm);
EEPROM.update(1, min_alarm);
EEPROM.update(2, alarm);
menu = 0;
w = 0;
}
delay(100);
}// loop
void buzzer() {
for (int i = 0; i < 200; i++) { // пищалка
digitalWrite(3, HIGH); delay(1); digitalWrite(3, LOW); delay(1);
}
}
void digit() {
switch (a[x]) {
case 0: d1 = 1, d2 = 8, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break; case 1: d1 = 32, d2 = 2, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break;
case 2: d1 = 2, d2 = 8, d3 = 6, d4 = 1, d5 = 4, d6 = 5; break; case 3: d1 = 2, d2 = 4, d3 = 6, d4 = 7, d5 = 3, d6 = 6; break;
case 4: d1 = 1, d2 = 3, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break; case 5: d1 = 1, d2 = 4, d3 = 5, d4 = 7, d5 = 3, d6 = 6; break;
case 6: d1 = 1, d2 = 4, d3 = 5, d4 = 1, d5 = 3, d6 = 6; break; case 7: d1 = 1, d2 = 8, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break;
case 8: d1 = 1, d2 = 4, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break; case 9: d1 = 1, d2 = 4, d3 = 6, d4 = 7, d5 = 3, d6 = 6; break;
case 10: d1 = 32, d2 = 32, d3 = 32, d4 = 32, d5 = 32, d6 = 32; break;
}
lcd.setCursor(e1, 0); lcd.write((uint8_t)d1); lcd.setCursor(e2, 0); lcd.write((uint8_t)d2); lcd.setCursor(e3, 0); lcd.write((uint8_t)d3);
lcd.setCursor(e1, 1); lcd.write((uint8_t)d4); lcd.setCursor(e2, 1); lcd.write((uint8_t)d5); lcd.setCursor(e3, 1); lcd.write((uint8_t)d6);
}
ISR(TIMER1_COMPA_vect) {
sec++;
if (sec > 59) {
sec = 0;
min++;
}
if (min > 59) {
min = 0;
hour++;
}
if (hour > 23) {
hour = 0;
}
}
правильно ли я мыслю по поводу изменений в исходном скетче или чего то не хватает?
#include <Wire.h>
#include <EEPROM.h>
#include <LiquidCrystal_I2C.h>
//Библиотека - http://forum.rcl-radio.ru/misc.php?action=pan_download&item=45&download=1
LiquidCrystal_I2C lcd(0x27, 16, 2); // Устанавливаем дисплей
byte v1[8] = {0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111, 0b00111};
byte v2[8] = {0b00111, 0b00111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
byte v3[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v4[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111, 0b11111};
byte v5[8] = {0b11100, 0b11100, 0b00000, 0b00000, 0b00000, 0b00000, 0b11100, 0b11100};
byte v6[8] = {0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100, 0b11100};
byte v7[8] = {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00111, 0b00111};
byte v8[8] = {0b11111, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000};
unsigned long times, times0, times1;
int sec, min, hour;
int min_alarm, hour_alarm;
int menu;
byte a[6], d1, d2, d3, d4, d5, d6, e1, e2, e3, x;
bool w, alarm;
void setup() {
Wire.begin();
lcd.init(); lcd.backlight(); // Включаем подсветку дисплея
//lcd.noBacklight();// Выключаем подсветку дисплея
pinMode(6, INPUT_PULLUP); // кнопка коррекции
pinMode(5, INPUT_PULLUP); // кнопка +
pinMode(4, INPUT_PULLUP); // кнопка -
pinMode(3, OUTPUT); // выход для пъезоизлучателя
lcd.createChar(1, v1); lcd.createChar(2, v2); lcd.createChar(3, v3); lcd.createChar(4, v4);
lcd.createChar(5, v5); lcd.createChar(6, v6); lcd.createChar(7, v7); lcd.createChar(8, v8);
cli();
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;
// (16000000/((15624+1)x1024))=1 Hz
//OCR1A = 15624; // корректировка точности часов
//OCR1A = 15587;//предварительный расчет
OCR1A = 15587;
TCCR1B |= (1 << WGM12);
// Prescaler 1024
TCCR1B |= (1 << CS12) | (1 << CS10);
TIMSK1 |= (1 << OCIE1A);
sei();
if (EEPROM.read(100) != 0) {
for (int i = 0; i < 101; i++) {
EEPROM.update(i, 0); // очистка памяти при первом включении
}
}
hour_alarm = EEPROM.read(0); min_alarm = EEPROM.read(1); alarm = EEPROM.read(2);
}
void loop() {
if (millis() - times < 500) {
w = 1;
}
if (millis() - times >= 500 && millis() - times < 600) {
w = 0;
}
if (millis() - times > 600) {
times = millis();
}
if (digitalRead(6) == LOW) {
menu++;
lcd.clear();
if (menu > 4) {
menu = 0;
} delay(300);
}
if (menu == 0) {
if (digitalRead(4) == LOW && alarm == 0) {
lcd.clear();
alarm = 1;
times = millis();
w = 1;
lcd.setCursor(0, 0);
lcd.print(" ALARM ON ");
delay(1000);
}
if (digitalRead(4) == LOW && alarm == 1) {
lcd.clear();
alarm = 0;
times = millis();
w = 1;
lcd.setCursor(0, 0);
lcd.print(" ALARM OFF");
delay(1000);
}
if (digitalRead(5) == LOW) { //сброс секунд
sec = 0;
}
}
/////////////////// ЧАСЫ /////////////////////////////////////////////////
if (menu == 0) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
/////////// мигание точек в режиме часы ////////////////////////////////
if (millis() - times1 > 900) {
lcd.setCursor(6, 0); lcd.print(" "); lcd.setCursor(6, 1); lcd.print(" ");
times1 = millis() ;
delay(100);
}
else {
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
}
///////////////////////////////////////////////////////////////////////////
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
if (alarm == 0) {
lcd.setCursor(13, 0);
//lcd.print("off");
}
if (alarm == 1) {
lcd.setCursor(13, 0);
lcd.print(" on");
}
}
/////////////////////////////////////////////////////////////////////////////////
///// korr hour
if (menu == 1) {
if (digitalRead(5) == LOW) {
hour++;
if (hour > 23) {
hour = 23;
} delay(100);
}
if (digitalRead(4) == LOW) {
hour--;
if (hour < 0) {
hour = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
else {
a[0] = 10;
a[1] = 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
}
///// korr min
if (menu == 2) {
if (digitalRead(5) == LOW) {
min++;
if (min > 59) {
min = 59;
} delay(100);
}
if (digitalRead(4) == LOW) {
min--;
if (min < 0) {
min = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = min / 10;
a[3] = min % 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
else {
a[0] = hour / 10;
a[1] = hour % 10;
a[2] = 10;
a[3] = 10;
a[4] = sec / 10;
a[5] = sec % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(14, 1); lcd.print(a[4]); lcd.setCursor(15, 1); lcd.print(a[5]);
}
///// korr hour alarm
if (menu == 3) {
if (digitalRead(5) == LOW) {
hour_alarm++;
times = millis();
w = 1;
if (hour_alarm > 23) {
hour_alarm = 23;
} delay(100);
}
if (digitalRead(4) == LOW) {
hour_alarm--;
times = millis();
w = 1;
if (hour_alarm < 0) {
hour_alarm = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
else {
a[0] = 10;
a[1] = 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(13, 0); lcd.print("KOR"); lcd.setCursor(13, 1); lcd.print("ALR");
}
///// korr min alarm
if (menu == 4) {
if (digitalRead(5) == LOW) {
min_alarm++;
times = millis();
w = 1;
if (min_alarm > 59) {
min_alarm = 59;
} delay(100);
}
if (digitalRead(4) == LOW) {
min_alarm--;
times = millis();
w = 1;
if (min_alarm < 0) {
min_alarm = 0;
} delay(100);
}
if (w == 1) {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = min_alarm / 10;
a[3] = min_alarm % 10;
}
else {
a[0] = hour_alarm / 10;
a[1] = hour_alarm % 10;
a[2] = 10;
a[3] = 10;
}
for (x = 0; x < 4; x++) {
switch (x) {
case 0: e1 = 0, e2 = 1, e3 = 2; break;
case 1: e1 = 3, e2 = 4, e3 = 5; break;
case 2: e1 = 7, e2 = 8, e3 = 9; break;
case 3: e1 = 10, e2 = 11, e3 = 12; break;
} digit();
}
lcd.setCursor(6, 0); lcd.print("."); lcd.setCursor(6, 1); lcd.print(".");
lcd.setCursor(13, 0); lcd.print("KOR"); lcd.setCursor(13, 1); lcd.print("ALR");
}
/// BUZZER
if (alarm == 1 && (hour * 100 + min == hour_alarm * 100 + min_alarm)) {
buzzer();
}
if (millis() - times > 10000 && w == 1) {
EEPROM.update(0, hour_alarm);
EEPROM.update(1, min_alarm);
EEPROM.update(2, alarm);
menu = 0;
w = 0;
}
delay(100);
}// loop
void buzzer() {
for (int i = 0; i < 200; i++) { // пищалка
digitalWrite(3, HIGH); delay(1); digitalWrite(3, LOW); delay(1);
}
}
void digit() {
switch (a[x]) {
case 0: d1 = 1, d2 = 8, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break;
case 1: d1 = 32, d2 = 2, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break;
case 2: d1 = 2, d2 = 8, d3 = 6, d4 = 1, d5 = 4, d6 = 5; break;
case 3: d1 = 2, d2 = 4, d3 = 6, d4 = 7, d5 = 3, d6 = 6; break;
case 4: d1 = 1, d2 = 3, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break;
case 5: d1 = 1, d2 = 4, d3 = 5, d4 = 7, d5 = 3, d6 = 6; break;
case 6: d1 = 1, d2 = 4, d3 = 5, d4 = 1, d5 = 3, d6 = 6; break;
case 7: d1 = 1, d2 = 8, d3 = 6, d4 = 32, d5 = 32, d6 = 6; break;
case 8: d1 = 1, d2 = 4, d3 = 6, d4 = 1, d5 = 3, d6 = 6; break;
case 9: d1 = 1, d2 = 4, d3 = 6, d4 = 7, d5 = 3, d6 = 6; break;
case 10: d1 = 32, d2 = 32, d3 = 32, d4 = 32, d5 = 32, d6 = 32; break;
}
lcd.setCursor(e1, 0); lcd.write((uint8_t)d1); lcd.setCursor(e2, 0);
lcd.write((uint8_t)d2); lcd.setCursor(e3, 0); lcd.write((uint8_t)d3);
lcd.setCursor(e1, 1); lcd.write((uint8_t)d4); lcd.setCursor(e2, 1);
lcd.write((uint8_t)d5); lcd.setCursor(e3, 1); lcd.write((uint8_t)d6);
}
ISR(TIMER1_COMPA_vect) {
sec++;
if (sec > 59) {
sec = 0;
min++;
}
if (min > 59) {
min = 0;
hour++;
}
if (hour > 23) {
hour = 0;
}
}