Hadzic Muharem Haris Šemić

Dependencies:   mbed

Committer:
tim003
Date:
Thu Apr 10 15:46:43 2014 +0000
Revision:
0:ae836b84be61
LV6-PAI-Grupa6-tim003

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tim003 0:ae836b84be61 1 #include "mbed.h"
tim003 0:ae836b84be61 2
tim003 0:ae836b84be61 3 BusOut prikaz1(dp26,dp25,dp24,dp23);
tim003 0:ae836b84be61 4 BusOut prikaz2(dp28,dp6,dp5,dp27);
tim003 0:ae836b84be61 5
tim003 0:ae836b84be61 6 DigitalOut enable(dp14);
tim003 0:ae836b84be61 7 InterruptIn taster(dp1);
tim003 0:ae836b84be61 8
tim003 0:ae836b84be61 9 Timer debounce;
tim003 0:ae836b84be61 10
tim003 0:ae836b84be61 11 const float T(2);
tim003 0:ae836b84be61 12 int brojac1(0);
tim003 0:ae836b84be61 13 int brojac2(0);
tim003 0:ae836b84be61 14
tim003 0:ae836b84be61 15 void f1(){
tim003 0:ae836b84be61 16 if(debounce.read_ms()>200){
tim003 0:ae836b84be61 17 brojac2=(brojac2+1)%16;
tim003 0:ae836b84be61 18 prikaz2=brojac2;
tim003 0:ae836b84be61 19 }
tim003 0:ae836b84be61 20 debounce.reset();
tim003 0:ae836b84be61 21 }
tim003 0:ae836b84be61 22
tim003 0:ae836b84be61 23 Ticker ticker;
tim003 0:ae836b84be61 24
tim003 0:ae836b84be61 25 void prikaz(){
tim003 0:ae836b84be61 26 brojac1=(brojac1+1)%16;
tim003 0:ae836b84be61 27 prikaz1=brojac1;
tim003 0:ae836b84be61 28 }
tim003 0:ae836b84be61 29
tim003 0:ae836b84be61 30 int main()
tim003 0:ae836b84be61 31 {
tim003 0:ae836b84be61 32 enable=0;
tim003 0:ae836b84be61 33 prikaz1=brojac1;
tim003 0:ae836b84be61 34 prikaz2=brojac2;
tim003 0:ae836b84be61 35 debounce.start();
tim003 0:ae836b84be61 36 taster.rise(&f1);
tim003 0:ae836b84be61 37 ticker.attach(&prikaz,T);
tim003 0:ae836b84be61 38 while(1) {
tim003 0:ae836b84be61 39
tim003 0:ae836b84be61 40 }
tim003 0:ae836b84be61 41 }