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

Revision:
0:56e6759813dc
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);
+        }            
+    }