![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Analog to digital and digital to analog conversion at 8 kHz rate on PA0 (A/D) and PA4 (D/A): use of timers and sleep() (to save energy). On PC8 there's a rising and falling signal to measure the time required by the A/D and D/A interrupt service routine.
Diff: main.cpp
- Revision:
- 0:57e0a19da71e
- Child:
- 1:a71233fe1e1c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 16 13:17:50 2014 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" + +Ticker toggle_led_ticker; + +DigitalOut led1(LED1); + +void toggle_led() { + led1 = !led1; +} + +int main() { + // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms) + toggle_led_ticker.attach(&toggle_led, 0.1); + while (true) { + // Do other things... + } +} \ No newline at end of file