Armin Klačar Maedeh Mousavi

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 brojac(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
00004 DigitalIn t1(dp1);
00005 DigitalIn t2(dp2);
00006 DigitalOut enable(dp14);
00007 
00008 int main()
00009 {
00010     int broj = 0;
00011     int taster1=0;
00012     int taster2=0;
00013     bool test1=false;
00014     bool test2=false;
00015     enable = 0;
00016     brojac = 0;
00017     while(1)
00018     {
00019         if(taster1==0&&t1==1&&test1==false) taster1=1;
00020         else {taster1=0;test1=true; if(t1==0) test1=false;}
00021         if(taster2==0&&t2==1&&test2==false)taster2=1;
00022         else {taster2=0;test2=true; if(t2==0) test2=false;}
00023         if(taster1==1)
00024         {
00025             if(broj == 255) broj = 0;
00026             brojac = broj;
00027             broj++;
00028         }
00029         else if(taster2==1)
00030         {
00031             if(!broj) broj = 255;
00032             brojac = broj;
00033             broj--;
00034         }
00035         wait(0.1);
00036     }
00037 }