ledControl.c
657 Bytes
#include <avr/io.h>
#include <util/delay.h>
#include <math.h>
#define NB_DRIVERS 3
#define MAX_VALUE 85 //TODO tbd !
#define DELAY 100
int main(void){
// Initialisation
unsigned int ledValues[NB_DRIVERS * DLED_CHANNELS];
init_LED_Drivers(NB_DRIVERS);
// Animation
unsigned int animTick = 0;
while(1){
// Build animation
for(int i=0; i<NB_DRIVERS * DLED_CHANNELS; i++){
double sinIn = (double) animTick / 8;
unsigned int val = (unsigned int) (0.5 + (sin(sinIn) * 0.5));
ledValues[i] = val * MAX_VALUE;
}
animTick++;
if(animTick >= 10000)
animTick = 0;
set_LED_Drivers(groupes, NB_DRIVERS);
_delay_ms(100);
}
return 0;
}