/*
Name: 8 LEDs
Author: GC1CEO
Date: 4/16/2025
Description:
A binary counter from 0 to 255 with just the MCU and 8 LEDs as outputs.
*/
//int leds[8] = {3,4,5,6,8,9,10,11};
int leds[8] = {11,10,9,8,6,5,4,3};
void setup() {
for(int i = 0; i <= 7; i++) {
pinMode(leds[i], OUTPUT);
}
Serial.begin(115200);
}
void loop() {
for(int x = 0; x <= 255; x++) {
sendtoLEDs(x);
delay(1000);
}
}
void sendtoLEDs(int data) {
for (int i = 0; i < 8; i++) {
digitalWrite(leds[i], (data & (1 << (7 - i))) ? HIGH : LOW);
}
}