a cada pulsació de l'entrada digital es commutarà l'estat del LED1, però només si la pulsació és prou llarga (+0.5 seg).
Revision 0:20238ee8b1e4, committed 2016-09-14
- Comitter:
- oriolgasset
- Date:
- Wed Sep 14 07:29:44 2016 +0000
- Commit message:
- Primer commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 20238ee8b1e4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 14 07:29:44 2016 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +DigitalIn enable(p17); +DigitalOut led(LED1); +Timer t; + +int main() { + while(1) { + if(enable){ + t.start(); + } else { + t.stop(); + if(t.read() > 0.5){ + led = !led; + } + t.reset(); + } + } +}
diff -r 000000000000 -r 20238ee8b1e4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 14 07:29:44 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897 \ No newline at end of file