Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 8:0cfa131f854c
- Parent:
- 7:dd77d598e6cb
- Child:
- 9:de7920643cbd
--- a/main.cpp Sat Dec 01 14:40:10 2018 +0000
+++ b/main.cpp Wed Dec 05 12:29:38 2018 +0000
@@ -1,7 +1,13 @@
#include "mbed.h"
+#define PRESSED 0
-/** Test
- * Nucleo-F091 Getting started
+/** Nucleo-F091 Getting started
+ *
+ * Basic fuctionality:
+ * - Controls LED
+ * - Reads userbutton
+ * - Prints on serial terminal
+ * - Reads character from serial terminal
*/
Serial pc(SERIAL_TX, SERIAL_RX);
@@ -17,7 +23,6 @@
wait(1.0f); //https://en.cppreference.com/w/cpp/language/floating_literal
onboardLed=!onboardLed;
wait(1.0f);
- onboardLed=0;
pc.printf("Press any key on the keyboard to start the program\n\r");
pc.putc(pc.getc()); //echo keyboard input, blocking wait
pc.printf(" was pressed\n\r");
@@ -34,7 +39,7 @@
onboardLed.write(0); //switch off
wait_ms(700);
pc.printf("This program runs since %d (0x%X) seconds.\n\r", i,i);
- if (userButton==0) {
+ if (userButton==PRESSED) {
pc.printf("Userbutton pressed\n\r");
}
i++; //increase loop counter