Ви не увійшли.
Сторінки 1
Устройство задумано так-
Отправляет ИК сигналы при нажатия на кнопки и параллельно(если так можно сказать) выводит текущее время на 4 разрядный индикатор. И вроде все работает, но вот проблема. При нажатие на кнопку(или кнопки), сигналы отправляются, а индикатор со временем мигает, точнее мигают первые три разряда, а четвертый становится более ярким. Выглядит некрасиво, в чем проблема? Можно это исправить?
Код:
#include "IRremote.h"
#include <iarduino_RTC.h>
IRsend irsend;
decode_results results;
iarduino_RTC time(RTC_DS3231);
int button1 = A0;
int button2 = A1;
int button3 = A2;
int button4 = A7;
int buttonChannelPlus = 0;
int buttonChannelMinus = 0;
int buttonVolPlus = 0;
int buttonVolMinus = 0;
int indOne = 5;
int indTwo = 6;
int indThree = 9;
int indFour = 10;
int a = 12;
int b = 13;
int c = 4;
int d = 11;
int e = 7;
int f = 2;
int g = A3;
int h = 8;
int digit = 0;
void setup() {
time.begin();
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
pinMode(indOne, OUTPUT);
pinMode(indTwo, OUTPUT);
pinMode(indThree, OUTPUT);
pinMode(indFour, OUTPUT);
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
pinMode(h, OUTPUT);
}
void loop() {
buttonChannelPlus = digitalRead(button1);
if (buttonChannelPlus == HIGH) {
buttonChannelMinus = digitalRead(button2);
if (buttonChannelMinus == HIGH) {
irsend.sendNEC(0x807F807F, 32);
}
else {
irsend.sendNEC(0x807FE817, 32);
}
}
buttonChannelMinus = digitalRead(button2);
if (buttonChannelMinus == HIGH) {
buttonChannelPlus = digitalRead(button1);
if (buttonChannelPlus == HIGH) {
irsend.sendNEC(0x807F807F, 32);
}
else {
irsend.sendNEC(0x807F58A7, 32);
}
}
buttonVolPlus = digitalRead(button3);
if (buttonVolPlus == HIGH) {
irsend.sendNEC(0x807F827D, 32);
}
buttonVolMinus = analogRead(button4);
if (buttonVolMinus > 500) {
irsend.sendNEC(0x807F42BD, 32);
}
showTime();
}
void showTime() {
time.gettime();
uint8_t valHours = time.Hours;
uint8_t valMinutes = time.minutes;
int valTimeOne = valHours / 10;
int valTimeTwo = valHours % 10;
int valTimeThree = valMinutes / 10;
int valTimeFour = valMinutes % 10;
digit = 1;
if (valTimeOne == 0) {
printNought();
}
else if (valTimeOne == 1) {
printOne();
}
else if (valTimeOne == 2) {
printTwo();
}
else if (valTimeOne == 3) {
printThree();
}
else if (valTimeOne == 4) {
printFour();
}
else if (valTimeOne == 5) {
printFive();
}
else if (valTimeOne == 6) {
printSix();
}
else if (valTimeOne == 7) {
printSeven();
}
else if (valTimeOne == 8) {
printEight();
}
else if (valTimeOne == 9) {
printNine();
}
delay(2);
digit = 2;
if (valTimeTwo == 0) {
printNought();
}
else if (valTimeTwo == 1) {
printOne();
}
else if (valTimeTwo == 2) {
printTwo();
}
else if (valTimeTwo == 3) {
printThree();
}
else if (valTimeTwo == 4) {
printFour();
}
else if (valTimeTwo == 5) {
printFive();
}
else if (valTimeTwo == 6) {
printSix();
}
else if (valTimeTwo == 7) {
printSeven();
}
else if (valTimeTwo == 8) {
printEight();
}
else if (valTimeTwo == 9) {
printNine();
}
delay(2);
digit = 3;
if (valTimeThree == 0) {
printNought();
}
else if (valTimeThree == 1) {
printOne();
}
else if (valTimeThree == 2) {
printTwo();
}
else if (valTimeThree == 3) {
printThree();
}
else if (valTimeThree == 4) {
printFour();
}
else if (valTimeThree == 5) {
printFive();
}
else if (valTimeThree == 6) {
printSix();
}
else if (valTimeThree == 7) {
printSeven();
}
else if (valTimeThree == 8) {
printEight();
}
else if (valTimeThree == 9) {
printNine();
}
delay(2);
digit = 4;
if (valTimeFour == 0) {
printNought();
}
else if (valTimeFour == 1) {
printOne();
}
else if (valTimeFour == 2) {
printTwo();
}
else if (valTimeFour == 3) {
printThree();
}
else if (valTimeFour == 4) {
printFour();
}
else if (valTimeFour == 5) {
printFive();
}
else if (valTimeFour == 6) {
printSix();
}
else if (valTimeFour == 7) {
printSeven();
}
else if (valTimeFour == 8) {
printEight();
}
else if (valTimeFour == 9) {
printNine();
}
delay(2);
}
И если нужно вот функции вывода цифр:
void printOne() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
}
void printTwo() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printThree() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printFour() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printFive() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printSix() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printSeven() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
}
void printEight() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printNine() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(h, LOW);
}
}
void printNought() {
if (digit == 1) {
digitalWrite(indOne, LOW);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 2) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, LOW);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, LOW);
digitalWrite(h, HIGH);
}
else if (digit == 3) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, LOW);
digitalWrite(indFour, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
else if (digit == 4) {
digitalWrite(indOne, HIGH);
digitalWrite(indTwo, HIGH);
digitalWrite(indThree, HIGH);
digitalWrite(indFour, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, LOW);
digitalWrite(h, LOW);
}
}
Выводы индикатора указаны в начале.
indOne/Two/Three/Four - разряды
a/b/c/d/e/f/g/h - сектора
Переменная "digit" указывает разряд, то есть если digit = 1;, и после этого printOne(); то в первом разряде будет цифра 1, digit = 2; - второй разряд и т.д.
Индикатор подключен по схеме(Нашел схему по модели в интернете):(
Без нажатия кнопок все работает стабильно и правильно, но при нажатии. Можно это исправить?
P.S. Arduino Pro Mini 5V
Неактивний
Динамическую индикацию надо делать в прерывании, тогда мерцания символов/сегментов не будет. Или взять модуль на ТМ1637.
Попытался, не получилось? Можете показать и объяснить как это работает на примере моего скетча?
Неактивний
Вы разговариваете с товарищем. Зазвонил телефон. Вы говорите товарищу "извини" и берёте трубку. Вот это и есть прерывание. А разговор по телефону - обработка прерывания. В этой обработке Вы будете заниматься индикацией. И если прерывания будут происходить регулярно, то индикация тоже будет равномерной, без дёрганий.
Это же как 2х2.
Неактивний
Ну примерно я понял, но ведь функции attachInterrupt нужно указать LOW, CHANGE и тд. Я не понимаю как это реализовать. Для прерывания у меня есть 2 свободный пин(0 int). Можете показать мне на примере моего скетча? Какой режим указать? (LOW CHANGE RISING FALLING)
Неактивний
Прерывания могут поступать как извне, так и изнутри. Телефон - это извне. Изнутри - это тоже самое что и телефон, только если бы Вам (к примеру) срочно захотелось в туалет... Вот те, что цепляются на пины - это внешние. Если у Вас есть кому регулярно дёргать извне - подключайте его к соответствующему пину и настраивайте через аттач. Ага?
Неактивний
Не понял причем тут извне и изнутри. Можете просто засунуть мне это в код, и показать (//) что конкретно выполняет, и в какой последовательности? Я боюсь того что отправка IR кода слишком долгая и мерцания останутся
Неактивний
Сторінки 1