test

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
taurin
Date:
Tue Nov 24 05:47:07 2015 +0000
Commit message:
igi

Changed in this revision

Servo.lib 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
servotest.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Tue Nov 24 05:47:07 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 24 05:47:07 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/servotest.cpp	Tue Nov 24 05:47:07 2015 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+PwmOut pwm(p21);
+
+int main() {
+    int start=510, end=2390;
+    while(1){
+        pwm.pulsewidth_us(start);
+        wait(5);
+        for(int p = start; p < end; p += 20) {
+            pwm.pulsewidth_us(p);
+            wait_ms(40);
+        }
+        pwm.pulsewidth_us(end);
+        wait(5);
+        for(int p = end; p >=start; p -= 20) {
+             pwm.pulsewidth_us(p);
+            wait_ms(40);
+        }
+    }
+}
\ No newline at end of file