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
Revision 0:fbe31567ebb8, committed 2015-12-10
- Comitter:
- DorijanMacek
- Date:
- Thu Dec 10 13:47:02 2015 +0000
- Commit message:
- 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.
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 |
--- /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 10 13:47:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file