ledControl.c 583 Bytes
#include <avr/io.h>
#include <util/delay.h>

int main(void){
	// SCLK PIN 37
	// SIN PIN 35
	DDRC = 0x03;
	uint8_t LEDs = {10, 20, 30, 40, 50, 60, 70, 80, 90,
		100, 110, 120, 130, 140, 150, 160, 170, 180, 190
		200, 210, 220, 230, 240};
	uint8_t ANDs = {0x001, 0x002, 0x004, 0x008, 0x010, 0x020, 0x040, 0x080,
		0x100, 0x200, 0x400, 0x800};

	while(1){
		for(int i=0; i<24; i++){
			uint16_t n = LEDs[i] << 4;
			int clkStatus = 0;
			for(int j=0; j<12; j++){
				if(j == 6)
					clkStatus = 1;
				PORTC = (n & ANDs[j]) << 1 | clkStatus;
				_delay_ms(1);
			}
		}
	}
	return 0;
}