void setup() {
volatile char *outf, *dirf;
volatile long i;
dirf = (volatile char*)0x30; // Set the direction register address
*dirf = 0xff; // Set all pins as output
outf = (volatile char*)0x31; // Set the output register address
*outf = 0x00; // Ensure all LEDs are off initially
while (1) {
for (int mask = 0x01; mask <= 0x80; mask <<= 1) {
*outf |= mask; // Turn on the current LED
for (i = 0; i < 100000; i++); // Delay
}
// Optionally, you can reset the sequence by turning off all LEDs and starting over
*outf = 0x00;
for (i = 0; i < 100000; i++);
}
}
void loop() {
// put your main code here, to run repeatedly:
}