PWM & DA test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tamaki
Date:
Thu Nov 17 04:59:44 2016 +0000
Commit message:
PWM test program

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 f7b022f1dec3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 17 04:59:44 2016 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+
+PwmOut myled1(LED1);
+PwmOut myled2(LED2);
+PwmOut myled3(LED3);
+PwmOut myled4(LED4);
+
+AnalogOut da(p18);
+
+//float si[] = {0.5,0.7,0.87,0.975,0.995,0.93,0.79,0.6,
+//             0.4,0.21,0.07,0.005,0.025,0.13,0.3};
+float si[] ={0.5,0.6,0.7,0.79,0.87,0.93,0.975,0.995,
+0.995,0.975,0.93,0.87,0.79,0.7,0.6,
+0.5,0.4,0.3,0.21,0.13,0.07,0.025,0.005,
+0.005,0.025,0.07,0.13,0.21,0.3,0.4};
+
+#define N 30
+
+int main() {
+    int i[5]={0,N/5,N*2/5,N*3/5,N*4/5};
+    while(1) {
+        myled1 = si[i[0]];
+        myled2 = si[i[1]];
+        myled3 = si[i[2]];
+        myled4 = si[i[3]];
+        da = si[i[4]];
+        wait(0.1);
+        for(int id = 0; id < 5; id++){
+            i[id]++;
+            i[id] = i[id]%N;
+        }
+    }
+}
diff -r 000000000000 -r f7b022f1dec3 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 17 04:59:44 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf
\ No newline at end of file