very simple 4ch PWM output demo for "mbed LPC824"

Dependencies:   mbed

Revision:
0:a7f40d4e5c58
diff -r 000000000000 -r a7f40d4e5c58 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 17 01:32:34 2014 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+#define     PI          3.14159265
+
+PwmOut pwm[]    = {
+    PwmOut( dp6 ),
+    PwmOut( dp7 ),
+    PwmOut( dp8 ),
+    PwmOut( dp9 ),
+};
+
+int main()
+{
+    int     count   = 0;
+    float   t       = PI / 40.0;
+
+    while(1) {
+        for ( int i = 0; i < 4; i++ ) {
+            pwm[ 0 ]    = powf( sin( t * (float)(count +  0) ), 2.0 );
+            pwm[ 1 ]    = powf( sin( t * (float)(count +  5) ), 2.0 );
+            pwm[ 2 ]    = powf( sin( t * (float)(count + 10) ), 2.0 );
+            pwm[ 3 ]    = powf( sin( t * (float)(count + 15) ), 2.0 );
+        }
+        wait_ms( 20 );
+        count++;
+    }
+}
+