Rune Kristiansen / Mbed 2 deprecated Nucleo_read_button

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 DigitalIn mybutton(USER_BUTTON);
00004 DigitalOut myled(LED1);
00005  
00006 int main() {
00007   while(1) {
00008     if (mybutton == 0) { // Button is pressed
00009       myled = !myled; // Toggle the LED state
00010       wait(0.2); // 200 ms
00011     }
00012   }
00013 }
00014