tim003 tim003
/
LV2_Grupa1_Tim003_Zadatak2
Irma Jakić Tarik Demirović
Revision 0:d515d96c18e3, committed 2014-03-10
- Comitter:
- tim003
- Date:
- Mon Mar 10 07:59:29 2014 +0000
- Commit message:
- LV2 - PAI - Grupa1 - Tim003
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 Mon Mar 10 07:59:29 2014 +0000 @@ -0,0 +1,66 @@ +#include "mbed.h" + +BusOut leds(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); +DigitalOut enable(dp14); +DigitalIn taster1(dp1); +DigitalIn taster2(dp2); + +bool pressed1() +{ + int j = 0; + while(taster1) + { + j++; + if(j > 1000) + { + return true; + } + } + j = 0; + return false; +} + +bool pressed2() +{ + int j = 0; + while(taster2) + { + j++; + if(j > 1000) + { + return true; + } + } + j = 0; + return false; +} + +int main() { + enable = 0; + leds = 0; + int i = 0; + while(1) { + if(pressed1()) + { + if(i == 256) + { + i = 0; + } + i++; + leds = i; + while(taster1){} + + } + if(pressed2()) + { + if(i == 0) + { + i = 257; + } + i--; + leds = i; + while(taster2) {} + } + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 10 07:59:29 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file