1 2 3 4 5 6 7 8 9 10 11 12 |
while (1)
{
for(tick = 0; tick < 1000; tick++)
{
hz = adc_read(0) >> 2;
scale = adc_read(1) >> 3;
translation = adc_read(2) >> 2;
x = M_PI/(500.0/hz);
OCR0A = (char)scale*sin(tick*x) + translation;
_delay_ms(1);
}
}
|