Counting up to 1023
Decided in the end to wire up all 10 LEDS in the LED bar graph.
Using the sketch below get the results shown in the video.
Circuit Diagram, I used an LED Bar graph but you could use separate LEDs.
Doodle’s Geek Monkey by Alastair Montgomery
Using the sketch below get the results shown in the video.
int numLed = 10; int ledpins[] = { 13,12,11,10,9,8,7,6,5,4}; int mask[] = { 1,2,4,8,16,32,64,128,256,512}; int counter = 0;void setup() {
// initialize the digital pin as an output. for (int i=0;i<numLed;i++){ pinMode(ledpins[i], OUTPUT); digitalWrite(ledpins[i], HIGH); delay(250); } }void loop() {
for (int i=0;i<numLed;i++){ if (counter & mask[i]) { digitalWrite(ledpins[i], HIGH); } else { digitalWrite(ledpins[i], LOW); } }
delay(1000); counter++; }
Circuit Diagram, I used an LED Bar graph but you could use separate LEDs.
Doodle’s Geek Monkey by Alastair Montgomery
