selma tucak edis kunic

Dependencies:   mbed

Fork of zadatak1tim003grupa7 by tim003 tim003

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 BusOut myled(dp23,dp24,dp25,dp26,dp27,dp5,dp6,dp28);
00004 DigitalOut enable(dp14);
00005 DigitalIn taster1(dp1);
00006 DigitalIn taster2(dp2);
00007 int main(){
00008     enable=0;
00009     int brojac=0;
00010     myled=0;
00011     int j;
00012     while(1) {
00013         j=0;
00014         if( taster1==1){
00015             for(int i=0;i<200;i++){
00016                 if(taster1==0) j++;
00017             }
00018             if(j>40){
00019             if(brojac==255)brojac=0;
00020             myled=brojac;
00021             wait(0.25);
00022             brojac++;
00023             }
00024         }
00025         if(taster2==1){
00026             for(int i=0;i<200;i++){
00027                 if(taster2==0) j++;
00028             }
00029             if(j>40){
00030             if(brojac==0){
00031                 brojac=255;
00032             }
00033             myled=brojac;
00034             wait(0.25);
00035             brojac--;
00036             }
00037         }
00038     }
00039 }