moving blinking led
This commit is contained in:
parent
7dba052e88
commit
e6dba2285a
50
main.c
50
main.c
@ -14,37 +14,53 @@
|
||||
int main (void)
|
||||
{
|
||||
int i;
|
||||
int colorb;
|
||||
char sample[128];
|
||||
char im[128];
|
||||
struct cRGB led_bar1[8];
|
||||
//DDRB = (1<<mic);//would be setting output, default is input so no need for setting
|
||||
//setupADC();
|
||||
setupADC();
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
led_bar1[i].r=10;
|
||||
led_bar1[i].g=10;
|
||||
led_bar1[i].b=10;
|
||||
|
||||
|
||||
|
||||
led_bar1[i].r=0;
|
||||
led_bar1[i].g=0;
|
||||
led_bar1[i].b=0;
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
//######RECORD SAMPLES#######
|
||||
/*for(i=0;i<128;i++)
|
||||
for(i=0;i<128;i++)
|
||||
{
|
||||
sample[i] = ADCH; //read Analog value register 8bit
|
||||
im[i]=0; //pseudo data for funciton
|
||||
}*/
|
||||
//fix_fft(sample,im,7,0);//im[i] is always zero
|
||||
led_bar1[0].r=0;led_bar1[0].g=100;led_bar1[0].b=10;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
_delay_ms(500);
|
||||
led_bar1[0].r=255;led_bar1[0].g=0;led_bar1[0].b=10;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
_delay_ms(500);
|
||||
}
|
||||
}
|
||||
fix_fft(sample,im,7,0);//im[i] is always zero
|
||||
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
for(colorb=0;colorb<256;colorb++)
|
||||
{
|
||||
led_bar1[i].r=10;led_bar1[i].g=colorb;led_bar1[i].b=0;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
_delay_ms(1);
|
||||
|
||||
}
|
||||
for(colorb=256;colorb>0;colorb--)
|
||||
{
|
||||
led_bar1[i].r=10;led_bar1[i].g=colorb;led_bar1[i].b=0;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
_delay_ms(1);
|
||||
|
||||
}
|
||||
led_bar1[0].r=0;led_bar1[0].g=100;led_bar1[0].b=10;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
_delay_ms(50);
|
||||
led_bar1[0].r=255;led_bar1[0].g=0;led_bar1[0].b=10;
|
||||
ws2812_sendarray((uint8_t *)led_bar1,8*3);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user