const int analogPin = A0;
const int ledCount[6][7]{ { 1,1,1,1,1,1,0 }, //0
{ 0,1,1,0,0,0,0 }, //1
{ 1,1,0,1,1,0,1 }, //2
{ 1,1,1,1,0,0,1 }, //3
{ 0,1,1,0,0,1,1 }, //4
{ 1,0,1,1,0,1,1 }, //5
};
int num_10bit,num_05;
int ledPins[] { 2,3,4,5,6,7,8};
void setup() {
for (int thisLed = 2; thisLed < ledPins; thisLed++){
pinMode(ledPins[thisLed], OUTPUT);
}
}
void loop () {
num_10bit=analogRead(analogPin);
num_05=map(num_10bit,0,1023,0,5);
seven_display();
}
void seven_display(){
for(int thisLed = 0; thisLed<7; thisLed++){
digitalWrite(ledPins[thisLed],ledCount[num_05][thisLed]);
}
}