Hi everybody, I am new to this site and I hope I am not making any of the mistakes people usually make in there first post. I am making a 64 led pov globe because I think they are one of the coolest things ever. :) I am using a Atmega328p as the brains, and 8 8-bit shift registers to run the leds. Now I am not a very big programmer so my code is very basic. I was wondering if there was a more efficient way than I have to write the code, to flash the leds. My code is very long, and, it is just a simple one to toggle all the leds on and off to see if they work. To advanced coders it is probably so badly written it may hurt to look at so be warned. :)

#define F_CPU 16000000UL #include#include int cycle(int data); int latch(void); int main(void) { DDRB = 0b000111; PORTB = 0b000000; while(1) { cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); latch(); _delay_ms(500); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); cycle(1); cycle(0); latch(); _delay_ms(500); } return 1; } int latch(void) { PORTB |= (1 << PIN2); PORTB &= ~(1 << PIN2); return 1; } int cycle(int data) { if (data == 0) { PORTB &= ~(1 << PIN0); PORTB |= (1 << PIN1); PORTB &= ~(1 << PIN1); } else { PORTB |= (1 << PIN0); PORTB |= (1 << PIN1); PORTB &= ~(1 << PIN1); } return 1; }