Dersler / Mbed 2 deprecated Nucleo_read_button

Dependencies:   mbed

Committer:
ctasdemir
Date:
Fri May 11 04:58:07 2018 +0000
Revision:
0:38b5112b5f3a
buton ?rne?i

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ctasdemir 0:38b5112b5f3a 1 #include "mbed.h"
ctasdemir 0:38b5112b5f3a 2 /*
ctasdemir 0:38b5112b5f3a 3 DigitalIn mybutton(USER_BUTTON);
ctasdemir 0:38b5112b5f3a 4 DigitalOut myled(LED1);
ctasdemir 0:38b5112b5f3a 5 */
ctasdemir 0:38b5112b5f3a 6 DigitalIn mybutton(PC_13);
ctasdemir 0:38b5112b5f3a 7 DigitalOut myled(PA_5);
ctasdemir 0:38b5112b5f3a 8
ctasdemir 0:38b5112b5f3a 9
ctasdemir 0:38b5112b5f3a 10 int main() {
ctasdemir 0:38b5112b5f3a 11 while(1) {
ctasdemir 0:38b5112b5f3a 12 if (mybutton.read() == 0) { // Button is pressed
ctasdemir 0:38b5112b5f3a 13 myled = !myled; // Toggle the LED state
ctasdemir 0:38b5112b5f3a 14 wait(0.2); // 200 ms
ctasdemir 0:38b5112b5f3a 15 }
ctasdemir 0:38b5112b5f3a 16 }
ctasdemir 0:38b5112b5f3a 17 }
ctasdemir 0:38b5112b5f3a 18