byte one [10][8] = {
{1,1,1,1,1,1,0,0}, //0
{0,1,1,0,0,0,0,0}, //1
{1,1,0,1,1,0,1,0}, //2
{1,1,1,1,0,0,1,0}, //3
{0,1,1,0,0,1,1,0}, //4
{1,0,1,1,0,1,1,0}, //5
{1,0,1,1,1,1,1,1}, //6.
{1,1,1,0,0,0,0,0}, //7
{1,1,1,1,1,1,1,0}, //8
{1,1,1,1,0,1,1,1}, //9.
};
#define DELAY 35
void setup() {
// put your setup code here, to run once:
for(int pin = 2; pin < 14; pin ++ ) {
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
}
}
void selectSection(byte section) {
// put your main code here, to run repeatedly:
for(byte i=10; i<=13; i++) {
digitalWrite(i, HIGH);
}
digitalWrite(section, LOW);
}
void drawDigit (int digit) {
for (int i = 0; i < 8; i++)
{
if( one[digit][i] == 1) digitalWrite(i+2, HIGH); else digitalWrite(i+2, LOW);
}
}
void loop() {
selectSection(10);
drawDigit(0);
delay(DELAY);
selectSection(11);
drawDigit(4);
delay(DELAY);
selectSection(12);
drawDigit(6);
delay(DELAY);
selectSection(13);
drawDigit(8);
delay(DELAY);
}