LED output example l by Soft PWM.

Dependencies:   SoftPWM mbed

Fork of pwmLED by Takemasa Nakamura

Revision:
0:b3a395ee08f3
Child:
1:155dd5b24708
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 17 05:53:09 2010 +0000
@@ -0,0 +1,28 @@
+/**
+* \file main.cpp
+* \brief main program
+*/
+
+#include "mbed.h"
+#include "math.h"
+
+// Blink the LED smoothly with PWM. 
+// Also, this project is test of the math function.
+
+/**
+* \brief LED to control
+*/
+PwmOut myled(LED1);
+
+
+/**
+* \brief main program
+*/
+int main() {
+    myled.period_ms( 1 );
+    while (1)
+        for ( int i=0; i<360; i+=10 ) {
+            myled = cos( i*2.0*3.14/360 ) * 0.5 + 0.5;
+            wait(0.03);
+        }
+}