Program pulses the board LED from 0% to 100% and back using soft PWM. Tested on Nucleo F030R8.

Dependencies:   mbed

Revision:
0:ee3ee6288b15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 27 16:54:20 2014 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+
+#define PWM_STEPS   100
+#define PWM_SPEED   50
+#define LED_ON      1
+#define LED_OFF     0
+
+DigitalOut myled(LED1);
+
+void blink_led(int from, int to) 
+{
+    for (int i = 0; i < PWM_STEPS; i++) { 
+        myled = from;
+        wait_us(i * PWM_SPEED);
+        
+        myled = to;
+        wait_us((PWM_STEPS - i) * PWM_SPEED);
+    }
+}
+
+int main() {
+    while (1) {    
+        blink_led(LED_ON, LED_OFF);
+        blink_led(LED_OFF, LED_ON);
+    }
+}