kumaresh kj
/
Nucleo_read_button
button (push to on switch) interfacing
Diff: main.cpp
- Revision:
- 0:61788d2c2807
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 17 12:55:30 2015 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" + +DigitalIn mybutton(USER_BUTTON); // user switch available in ST32 nucleo boards +DigitalIn sw1(PC_13); // refer UM1724 ST nucleo User manual for pin details +DigitalOut myled(LED1); + +int main() { + while(1) { + if (sw1 == 0) { // or you can use mybutton + myled = !myled; // Toggle the LED state + wait(0.2); // 200 ms + } + } +} + \ No newline at end of file