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:
- 2021-09-16
- Revision:
- 5:4914c66f9a74
- Parent:
- 4:20d75a9afbbd
File content as of revision 5:4914c66f9a74:
#include "mbed.h" int main() { // Initialise the digital pin BUTTON1 (the blue button) as an input DigitalIn button(BUTTON1); // 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); } }