#include <iom16v.h>
#include <macros.h>
#include <math.h>
#define uint unsigned int
#define uchar unsigned char
#define k 50.0
void delay(uint ms)
{
uint x,y;
for(x=ms;x>0;x--)
for(y=1141;y>0;y--);
}
float LtoP(float bright)
{
float LtoPtemp,LtoPout;
LtoPtemp=pow(k+1,bright);
LtoPout=(1/k)*(LtoPtemp-1);
return LtoPout;
}
void main(void)
{
uint i;
DDRA=0xff;
PORTA=0xff;
DDRD|=BIT(4)|BIT(5);
TCCR1A=0x73;
TCCR1B=0x19;
OCR1A=7999;
OCR1B=6000;
SREG|=BIT(7);
while(1)
{
for(i=0;i<10;i++)
{
OCR1B=7999*LtoP(i/10.0);
delay(1000);
}
}
}