Adam Stanić / Mbed 2 deprecated LV1ZAD3

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #define dp23 P0_0
00003  
00004  
00005  
00006  
00007 DigitalOut enable(dp14);
00008  
00009  
00010  
00011 BusOut bus  (dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28);
00012  
00013 DigitalIn ulaz(dp1);
00014  
00015  
00016 int main() {
00017     enable=0;
00018    
00019     while(1)
00020     {
00021    
00022     bool istina=false;
00023     bus=0;
00024    
00025     for(int i=0;i<128;i++)
00026         {
00027             bus=i;
00028             wait(1);
00029            
00030             if(ulaz==1)
00031                 {
00032                     int j=i;
00033                     for(j=i;j>0;j--)
00034                     {
00035                         bus=j;
00036                         wait(1);
00037                         if(j==0)
00038                             {
00039                                 istina=true;
00040                                 i=0;
00041                                 }
00042                     }
00043                     if(istina) break;
00044                    
00045                 }
00046                 if(istina) break;
00047  
00048            
00049         }
00050     }
00051     }