![](/media/cache/profiles/5487e79fa0ccd0b79e5d4a4c8ced005d.50x50_q85.jpg)
Testing to see if fread blocks Ticker(). It does.
main.cpp
- Committer:
- opiette
- Date:
- 2010-10-05
- Revision:
- 0:8d0e8caaf3e4
File content as of revision 0:8d0e8caaf3e4:
#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; } }