// x a b c d f g
//0: 0 1 1 1 1 1 0 0x7E
//1: 0 0 1 1 0 0 0 0x30
// 0 1 2 3 4 5 6 7 8 9
int digit[]={0b00111111,0b00000110,0b01011011,0b01001111,0b01100110,0b01101101,0b01111101,0b00000111,0b01111111,0b01101111};
int x = 0;
void setup() {
// put your setup code here, to run once:
//Serial.begin(115200);
DDRD= 0xFF;
PORTD = 1<<PD7;//PORTD |=0x80;
randomSeed(analogRead(A0));
x = random(1,10);
}
void loop(){
// put your main code here, to run repeatedly:
int k = digit[x];
pinMode(7, INPUT_PULLUP);
if(digitalRead(7)==LOW && x>0){
x --;
delay(300);
}
for (int x = 0;x<7;x++){
int temp = k & 0x01;
digitalWrite(x,temp);
k=k>>1;
}
}
/*
void loop() {
// put your main code here, to run repeatedly:
bool vhod = PIND & 0x80;
if(vhod == LOW){
x--;
delay(500);
if(x<=0)x=0;
}
PORTD = digit[x] | 0x80;
delay(500);
}
*/