#include #include #include"fix_fft.h" #include"avr_adc.h" #include"light_ws2812_AVR/Light_WS2812/ws2812_config.h" #include"light_ws2812_AVR/Light_WS2812/light_ws2812.h" #include"main.h" #define STARTADC ADCSRA |= (1< 16 bins // //1-7.8 - ca 130hz //2- 255hz //3- 380 //4- 505 //5- 630 //6- 755 //7- 880 //8- 1kHz // const float log_scale = 64./log(64./SCALE_FACTOR + 1.); int msec; int main (void) { int i,i2; int colorb; int colora; int sum,avg; char sample[64]; char im[64]; char buff[64]; char temp; msec=0; struct cRGB led_bar1[8]; //DDRB = (1<64) sample[i]=64; sample[i] = sample[i] *SCALE_FACTOR; sample[i] = (sample[i]*0.7 + buff[i]*0.3); buff[i] = sample[i]; } for(i=0;i<8;i++) { for(i2=1;i2<=4;i2++) { sample[i] = ((sample[i] + sample[i*8+i2])/2); } //avg written to sample[0..7] if(sample[i]<20) { led_bar1[i].r=0; led_bar1[i].g=0; led_bar1[i].b=sample[i]; } else if(sample[i]<40) { led_bar1[i].r=0; led_bar1[i].g=sample[i]; led_bar1[i].b=sample[i]/2; } else if(sample[i]<60) { led_bar1[i].r=sample[i]; led_bar1[i].g=0; led_bar1[i].b=sample[i]/2; } } ws2812_setleds(led_bar1,8); } return 0; } int map(int value, int old_min, int old_max,int new_min, int new_max) { return (new_max/old_max*value); } void setupTimer(void) { TCCR1 = (1<