Stap 6: De Arduino
int pinA1 = 8;
int pinA2 = 9;
int pinA3 = 10;
VOID Setup {}
for (int i = 1; ik < = 10; i ++) {}
pinMode (ik, OUTPUT);
digitalWrite (i, laag);
}
digitalWrite (2, laag); Grond
digitalWrite (3, hoge); Macht
digitalWrite (4, HIGH); MUX input te sturen naar de LED 's
}
VOID ledOn(int nr)
{
int r0 = nr & 0x01;
int r1 = (nr >> 1) & 0x01;
int r2 = (nr >> 2) & 0x01;
digitalWrite (pinA1, r0);
digitalWrite (pinA2, r1);
digitalWrite (pinA3, r2);
}
void loop {}
for (int j = 0; j < 8; j ++) {}
ledOn(j);
delay(10);
}
for (int j = 7; j > = 0; j--) {}
ledOn(j);
delay(50);
}
}