Jawjiw / Mbed 2 deprecated button

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 Serial pc(D1,D0);    // Configure LED1 pin as output
00004 DigitalIn button1(D2); 
00005 DigitalIn button2(D3); // Configure P1_14 pin as input
00006 
00007 int main()
00008 {
00009     while(1) {
00010         if(button1 == 1){pc.printf("1HIGH\n");}
00011         if(button2 == 0){pc.printf("1LOW\n");}   
00012         if(button2 == 1){pc.printf("2HIGH\n");}
00013         if(button2 == 0){pc.printf("2LOW\n");}   /* read the state of input  pin P1_14 and write it to output port pin LED1*/
00014     }
00015 }