Matthaeus Vorraber / Mbed 2 deprecated Button_runlight_Interrupt

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     //      D20,D19,D18,D17,...
00004 BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
00005 
00006     // Sw4 als Interrupt definieren
00007 InterruptIn sw4(P1_16);
00008 
00009 
00010 void OneRunLightStep2();
00011 
00012 void ButtonISR()
00013 {   
00014     if(sw4.read()==1)
00015     OneRunLightStep2();
00016 }
00017 
00018 int main()
00019 
00020 {   
00021     sw4.rise(ButtonISR);
00022     while(1)
00023     {
00024     }
00025   
00026 }
00027 
00028 
00029 void OneRunLightStep2()
00030 {
00031     if(lb==0)
00032     lb=1;
00033     else
00034     lb=lb<<1;   // Finster
00035 }
00036 
00037         
00038         
00039     
00040     
00041     
00042     
00043     
00044 
00045