int digit[] = {0x7E, 0x30, 0x6D, 0x79, 0x33, 0x5B, 0x5F, 0x70, 0x7F, 0x7B};
int stRandom;
int count;
void setup() {
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP); // Dodana tipka na pinu 8 kot INPUT_PULLUP
for (int x = 0; x < 7; x++) { // Vse pine od 0-6 nastavi na output
pinMode(x, OUTPUT);
}
randomSeed(analogRead(A0)); // Random funkcija
count = random(1, 5);
}
void loop() {
int k = digit[count];
// Če je pritisnjena tipka na pinu 8, povečaj count in prepreči prehod preko meja polja
if (digitalRead(8) == LOW && count < 9) {
count++;
delay(300);
}
// Če je pritisnjena tipka na pinu 9, ponastavi count na 0
if (digitalRead(7) == LOW) {
count = 0;
delay(300);
}
for (int x = 0; x < 7; x++) {
int temp = k & 0x01;
digitalWrite(x, temp);
k >>= 1;
}
}
//input mikrokrmilnik sprejema podatke
//output oddaja podatke 0ali1
/*void setup() {
// put your setup code here, to run once:
DDRD=0x7F;
PORTD=1<<PD7;
randomSeed(analogRead(A0));
count=random(1,10);
}
void loop() {
// put your main code here, to run repeatedly:
bool vhod=PIND&0x80;
if(vhod==LOW){
count--;
delay(500);
if(count <=0) count=0;
}
PORTD=digit[count]| 0x80;
}*/