tim008 tim008
/
LV2_Grupa5_TIM008-zadatak2
Emir Mujačić Amela Špica
main.cpp
- Committer:
- tim008
- Date:
- 2014-03-13
- Revision:
- 0:8a8efa06ba06
File content as of revision 0:8a8efa06ba06:
#include "mbed.h" BusOut led(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); DigitalOut enabled(dp14); DigitalIn taster1(dp1); DigitalIn taster2(dp2); int main() { int p1 = 0, p2 =0; int brojac = 0, a = 0; enabled=0; led = brojac; while(1) { if (p1==1) { a++; if (taster1 == 1 && a > 1000) { brojac++; a = 0; } } if (p2==1) { a++; if (taster2 == 1 && a > 1000) {brojac--; a = 0;} } if(taster1 == 0) p1=1; else p1=0; if(taster2 == 0) p2=1; else p2=0; if (brojac < 0) brojac = 255; if (brojac > 255) brojac = 0; led= brojac; } }