Adnan Kičin Adnan Hajrić

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 DigitalIn taster1(dp1);
00004 DigitalIn taster2(dp2);
00005 BusOut myleds(dp23,dp24,dp25,dp26,dp27,dp5,dp6,dp28);
00006 DigitalOut enable (dp14);
00007 
00008 bool taster_jedan(){
00009     bool pricinut = false;
00010     int i=0;
00011     while(taster1) i++;
00012     if(i>5000) pricinut=true;
00013     return pricinut;
00014 }
00015 
00016 bool taster_dva(){
00017     bool pricinut = false;
00018     int i=0;
00019     while(taster2) i++;
00020     if(i>5000) pricinut=true;
00021     return pricinut;
00022 }        
00023 
00024 int main() {
00025     enable=0;
00026     myleds=0;
00027     while(myleds<256 && myleds>=0) {
00028         if(taster_jedan()) myleds=myleds+1;
00029         else if(taster_dva()) myleds = myleds-1;
00030     }
00031 }