Demo using the user button and serial port on the Nucleo board, for Stage 1 Engineering at the University of York
main.cpp
- Committer:
- ajp109
- Date:
- 2020-11-21
- Revision:
- 4:20d75a9afbbd
- Parent:
- 3:e09e8c0d8dea
- Child:
- 5:4914c66f9a74
File content as of revision 4:20d75a9afbbd:
#include "mbed.h" int main() { // Initialise the digital pin USER_BUTTON (the blue button) as an input DigitalIn button(USER_BUTTON); // Loop forever... while (true) { // Is the button being pressed? if (button == true) { printf("Button is up\n"); } else { printf("Button is down\n"); } // Wait for 500ms thread_sleep_for(500); } }