KIK 01 Prototype 05
Dependencies: AverageMCP3008 mbed-rtos mbed mcp3008
Fork of KIK01_Proto03 by
Diff: main.cpp
- Revision:
- 1:f9b967ae26e4
- Parent:
- 0:2dcec10e9199
- Child:
- 2:8dff77a1ee4d
diff -r 2dcec10e9199 -r f9b967ae26e4 main.cpp --- a/main.cpp Sun Jun 04 05:27:59 2017 +0000 +++ b/main.cpp Sun Jun 04 05:33:49 2017 +0000 @@ -104,9 +104,7 @@ phi -= 2.0f; } float level = sinf(PI_F * phi) * amplitude; - //printf("%d\t%f\t%f\t%f\r\n", ticks, frequency, amplitude, level); - //printf("%f\r\n", level); - //Dac1.write_u16((uint16_t)((level + 1.0f) * 0X3FFF)); + Dac1.write((level + 1.0f) / 2.0f); } @@ -133,8 +131,8 @@ phiDelta = 2.0f * frequency / SAMPLING_RATE; amplitude = 1.0f; - for (;;) { - generateWave(); - wait(SAMPLING_PERIOD); - } + Ticker waveTicker; + waveTicker.attach(&generateWave, SAMPLING_PERIOD); + + for (;;) {} }