// 8 4 2 1 8 4 2 1
// x a b c d e f g
//o:0 1 1 1 1 1 1 0 Ox7E
//1:0 0 1 1 0 0 0 0 0x30
//2:0 1 1 0 1 1 0 1 0x6D
//3:0 1 1 1 1 0 0 1 0x79
//4:0 0 1 1 0 0 1 1 0x33
//5:0 1 0 1 1 0 1 1 0x5B
//6:0 1 0 1 1 1 1 1 0x5F
//7:0 1 1 1 0 0 0 0 0x70
//8:0 1 1 1 1 1 1 1 0x7F
//9:0 1 1 1 0 0 1 1 0x73
int stRandom;
int digit[] = {0x7E,0x30,0x6D,0x79,0x33,0x5B,0x5F,0x70,0x7F,0x73};
int pin[] = {9,10,2,3,4,5,6};
int count;
//setup se izvede samo enkrat
void setup(){
pinMode(7, INPUT_PULLUP);
for (int x = 0;x<7;x++ ){
pinMode(x, OUTPUT);
}
randomSeed(analogRead(A0));
count = random(1,10);
}
void loop(){
int k = digit[count];
if (digitalRead(7)==LOW & count > 0){
count--;
delay(300);
}
for (int x= 0;x<7;x++){
int temp = k & 0x01;
digitalWrite(x,temp);
k=k >> 1;//šiftamo za eno levo
}
}
/*void setup() {
DDRD=0x7F;
PORTD= 1 << PD7; //PORTD |= 0x80; // pull up
randomSeed(analogRead(A0));
count = random(0,10);
}
void loop() {
bool vhod = PIND & 0x80;
if ( vhod == LOW){
count--;
if (count <=0) count = 0;
}
PORTD =digit[count];// | 0x80; // | or ali
}
*/