Jakić Irma Kiselica Aldin

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 BusOut prikaz1(dp26,dp25,dp24,dp23);
00004 BusOut prikaz2(dp28,dp6,dp5,dp27);
00005  
00006 DigitalOut enable(dp14);
00007 InterruptIn taster(dp1);
00008  
00009 int brojac1(0);
00010 int brojac2(0);
00011 const float T(2);
00012 Timer belaj;
00013  
00014 void countOn()
00015 {
00016     if(belaj.read_ms()>200)
00017     {
00018         brojac2=(brojac2+1)%16;
00019         belaj.reset();
00020     }
00021 }
00022  
00023 Ticker stopwatch;
00024  
00025 void counter()
00026 {
00027     prikaz2=brojac2;
00028 }
00029  
00030 int main()
00031 {
00032     enable=0;
00033     prikaz2 = brojac2;
00034     taster.rise(countOn);
00035     belaj.start();
00036     stopwatch.attach(counter, 0.03);
00037     while(1) {
00038         wait(T);
00039     brojac1=(brojac1+1)%16;
00040     prikaz1 = brojac1;
00041     
00042         }
00043 }