Napravite sustav koji broji koliko puta je digitalni prekidač pritisnut (tj. promijenjen mu je položaj), a nakon što izbroji 10 puta, pali se LED dioda.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:fbe31567ebb8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 10 13:47:02 2015 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" + +int main() { + DigitalOut myled(LED1); + DigitalIn sw(p5); + sw.mode(PullUp); + int counter=0; + + +while(1) +{ + if (sw==1) + { + counter++; + } + if((counter%9)==0) + { + myled = 1; + } + +} +} \ No newline at end of file