Jawjiw / Mbed 2 deprecated button

Dependencies:   mbed

Committer:
cakejohnn
Date:
Tue Dec 18 21:18:40 2018 +0000
Revision:
0:38c4995b3635
nm./

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cakejohnn 0:38c4995b3635 1 #include "mbed.h"
cakejohnn 0:38c4995b3635 2
cakejohnn 0:38c4995b3635 3 Serial pc(D1,D0); // Configure LED1 pin as output
cakejohnn 0:38c4995b3635 4 DigitalIn button1(D2);
cakejohnn 0:38c4995b3635 5 DigitalIn button2(D3); // Configure P1_14 pin as input
cakejohnn 0:38c4995b3635 6
cakejohnn 0:38c4995b3635 7 int main()
cakejohnn 0:38c4995b3635 8 {
cakejohnn 0:38c4995b3635 9 while(1) {
cakejohnn 0:38c4995b3635 10 if(button1 == 1){pc.printf("1HIGH\n");}
cakejohnn 0:38c4995b3635 11 if(button2 == 0){pc.printf("1LOW\n");}
cakejohnn 0:38c4995b3635 12 if(button2 == 1){pc.printf("2HIGH\n");}
cakejohnn 0:38c4995b3635 13 if(button2 == 0){pc.printf("2LOW\n");} /* read the state of input pin P1_14 and write it to output port pin LED1*/
cakejohnn 0:38c4995b3635 14 }
cakejohnn 0:38c4995b3635 15 }