tim003 tim003
/
Zadataktim3
Anes Luckin Selma Tucak
Diff: main.cpp
- Revision:
- 0:87d8d39674fb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 20 18:27:58 2014 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +BusOut led(dp26, dp27, dp5, dp6, dp28, dp1, dp2); +BusOut dec(dp23, dp24, dp25); +BusOut tacka(dp4); + +int broj[10] = {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10}; + +Timer brojac; + +void funk(float v) +{ + int des= (int) (v)/10; + int jed = (int) (v)%10; + int stot = (v -int(v))*10; + led=broj[stot]; + dec=3; +wait_ms(2); + +led=broj[jed]; +dec=5; +tacka=0; + +wait_ms(2); + + +tacka=1; + led=broj[des]; +dec=6; + + wait_ms(2); + + dec=7; + +} + +int main() { + dec = 0; + led = broj[0]; + wait(2); + brojac.start(); + float v = 0; + + while(1) { + + if(v<=12.3) + v = brojac.read(); + funk(v); + } +}