void setup() {
// put your setup code here, to run once:
volatile char *dirf;
dirf = 0x30;
*dirf = 0xFF;
}
void loop() {
// put your main code here, to run repeatedly:
// Glow the LEDs in following order
// 3,7 delay – 2,6 delay – 1,5 delay – 0,4 delay
volatile char *output, x;
volatile long i;
char leds[8] = {0x01, 0x04, 0x02, 0x08, 0x10, 0x40, 0x20, 0x80};
output = 0x31;
//************************************
// Glow the LEDs in following order
// 3,7 delay – 2,6 delay – 1,5 delay – 0,4 delay
//*output |= 0x88; // 3,7
//for (i = 0; i < 200000; i++);
//*output |= 0x44; // 2,6
//for (i = 0; i < 200000; i++);
//*output |= 0x22; // 1,5 0010 0010
//for (i = 0; i < 200000; i++);
//*output |= 0x11; // 0,4
//************************************
// Glow the LEDs in following order
// 0,4 delay – 1,5 delay – 2,6 delay – 3,7 delay
//*output |= 0x11; // 0,4
//for (i = 0; i < 200000; i++);
//*output |= 0x22; // 1,5
//for (i = 0; i < 200000; i++);
//*output |= 0x44; // 2,6
//for (i = 0; i < 200000; i++);
//*output |= 0x88; // 3,7
//************************************
// Glow 0 to 7 LEDs with delay and 7 to 0 LEDs with delay
//for (x = 0; x < 8; x++) {
// *output |= 1 << x;
// for (i = 0; i < 200000; i++);
//}
//*output = 0x00;
//for (x = 7; x >= 0; x--) {
// *output |= 1 << x;
// for (i = 0; i < 200000; i++);
//}
//************************************
// Glow 0,2,1,3,4,6,5,7 LEDs with delay
//0000 0001 0x01 - 0000 0100 0x04 - 0000 0010 0x02 - 0000 1000 0x08 - 0000 0000 0x10
//0100 0000 0x40 - 0010 0000 0x20 - 1000 0000 0x80
for (x = 0; x < 8; x++) {
*output |= leds[x];
for (i = 0; i < 200000; i++);
}
}