M0_Übung_6

Dependencies:   mbed

Fork of M0_Lektion06 by Gottfried Enenkel

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 // **** DEFINITIONEN ****
00004 
00005 DigitalOut LedD1(LED1);
00006 DigitalOut LedD2(LED2);
00007 DigitalOut LedD3(LED3);
00008 DigitalOut LedD4(LED4);
00009 
00010 DigitalIn  SW1(P0_10);
00011 DigitalIn  SW2(P0_15);
00012 DigitalIn  SW3(P0_23);
00013 DigitalIn  SW4(P1_16);
00014 
00015 // **** Hauptprogramm ****
00016 int main() {
00017     while(1) {
00018         if (SW1==1)   //SW1                                
00019         
00020           LedD1=1;    
00021           
00022         else 
00023         {     
00024           LedD1=0;  
00025         }          
00026         wait (0.01);   
00027                                   
00028         if (SW2==1)   //SW2
00029                                           
00030           LedD2=1; 
00031              
00032         else 
00033         {        
00034           LedD2=0;          
00035         }  
00036         wait (0.01); 
00037         
00038         if (SW3==1)   //SW3
00039                                           
00040           LedD3=1; 
00041              
00042         else 
00043         {        
00044           LedD3=0;          
00045         }  
00046         wait (0.01); 
00047         
00048         if (SW4==1)   //SW4
00049                                           
00050           LedD4=1; 
00051              
00052         else 
00053         {        
00054           LedD4=0;          
00055         }  
00056         wait (0.01); 
00057         
00058     }
00059 }
00060 // **** ENDE ****