
Eldar Granulo Faris Odobasic
Diff: main.cpp
- Revision:
- 0:c815fa07c2ef
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 10 11:00:00 2014 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" + BusOut myledsarray(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); + +DigitalOut enable(dp14); +DigitalIn taster1(dp1); +DigitalIn taster2(dp2); + +void enlarge() +{ + int counter = 0; + for(int i = 0; i < 1000; i++) + { + if(taster1 == 1) counter++; + else break; + + + } + if(counter > 500) + myledsarray = (myledsarray + 1) % 256; + +} + +void decrement() +{ + int count = 0; + for(int i = 0;i < 1000; i++) + { + if(taster2 == 1) count++; + else break; + + } + if(count > 500) + { + if(myledsarray == 0) myledsarray = 255; + else myledsarray = (myledsarray - 1) % 256; + } + +} + +int main() +{ + + + InterruptIn taster1(dp1); + InterruptIn taster2(dp2); + myledsarray= 0; + enable = 0; + + + + while(1) + { + taster1.rise(&enlarge); + taster2.rise(&decrement); + } + + +} \ No newline at end of file