![](/media/cache/profiles/5487e79fa0ccd0b79e5d4a4c8ced005d.50x50_q85.jpg)
Testing to see if fread blocks Ticker(). It does.
Diff: main.cpp
- Revision:
- 0:8d0e8caaf3e4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 05 03:47:18 2010 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); +Ticker tick; +LocalFileSystem sd("sd"); + +void flash(void){ + if (led1 == 1) + led1 = 0; + else + led1=1; +} + + +int main() { + + FILE* fp = fopen("/sd/test.wav","rb"); +tick.attach_us(&flash, 1000); + + while(1) { + led2 = 1; + wait_ms(1000); + led2 = 0; + + char* buffer; + buffer = (char*)malloc(8000); + + led3 = 1; + wait_ms(1000); + led3 = 0; + + fread(buffer, 1, 8000, fp); + + led4 = 1; + wait_ms(1000); + led4 = 0; + } +}