This program is a replacement candidate for the original "Blinky LED" demo program which is stored on the STM32F401 Nucleo board, as shipped. Note that the original demo program is, as are all subsequent programs which are flashed to the board, replaced by a later program deposited on the Nucleo which is then loaded by the Nucleo for execution.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
nucleo
Date:
Sun May 18 13:20:12 2014 +0000
Commit message:
STM32F401 Nucleo :: A replacement "Blinky LED" program, similar to the original demo program flashed on the board as shipped. Note that the original demo is erased after a later program is stored and so is not retrievable.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 56e6759813dc main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun May 18 13:20:12 2014 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "stdlib.h"
+
+InterruptIn mybutton(PC_13); // B1
+
+DigitalOut myled(LED1);
+
+double multiplier = 500.0;  // maximum delay
+
+
+int delay = 500; // initial on-off time in milliseconds
+
+void random_on_off() {
+         delay = int(multiplier * float(rand()) / RAND_MAX);
+         }
+
+int main() {
+    srand(rand());
+    while(1) {
+        myled = !myled;
+        mybutton.fall(&random_on_off);
+        wait_ms(delay);
+        }            
+    }
diff -r 000000000000 -r 56e6759813dc mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun May 18 13:20:12 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file