help
/
Info_2_TD
Diff: Partie_5/Exercice_3.cpp
- Revision:
- 0:4651c5d6ca1e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Partie_5/Exercice_3.cpp Thu Jun 25 16:30:18 2020 +0000 @@ -0,0 +1,22 @@ +/*#include "mbed.h" +InterruptIn button(p30); +DigitalOut led1(LED1); +Timer debounce; +LocalFileSystem local("local"); +void toggle(void); +int main() { +button.mode(PullUp); +debounce.start(); +button.rise(&toggle); +while(1); +} +void toggle() { + if (debounce.read_ms()>200) { + led1.write(!led1.read()); + FILE* pfile = fopen ("/local/log.txt","a"); + fprintf(pfile,"time=%.3fs: setting led=%d\n\r", +debounce.read(),led1.read()); + fclose(pfile); // close file + debounce.reset(); // reset debounce timer + } +} */ \ No newline at end of file