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.

Dependencies:   mbed-src mbed

Committer:
bcostm
Date:
Tue Dec 16 13:17:50 2014 +0000
Revision:
0:57e0a19da71e
Child:
1:a71233fe1e1c
Initial version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:57e0a19da71e 1 #include "mbed.h"
bcostm 0:57e0a19da71e 2
bcostm 0:57e0a19da71e 3 Ticker toggle_led_ticker;
bcostm 0:57e0a19da71e 4
bcostm 0:57e0a19da71e 5 DigitalOut led1(LED1);
bcostm 0:57e0a19da71e 6
bcostm 0:57e0a19da71e 7 void toggle_led() {
bcostm 0:57e0a19da71e 8 led1 = !led1;
bcostm 0:57e0a19da71e 9 }
bcostm 0:57e0a19da71e 10
bcostm 0:57e0a19da71e 11 int main() {
bcostm 0:57e0a19da71e 12 // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
bcostm 0:57e0a19da71e 13 toggle_led_ticker.attach(&toggle_led, 0.1);
bcostm 0:57e0a19da71e 14 while (true) {
bcostm 0:57e0a19da71e 15 // Do other things...
bcostm 0:57e0a19da71e 16 }
bcostm 0:57e0a19da71e 17 }