サーボ制御

Dependencies:   mbed Servo

Files at this revision

API Documentation at this revision

Comitter:
tomotsugu
Date:
Mon Jul 13 03:27:34 2020 +0000
Commit message:
Servo

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
resources/main.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	Mon Jul 13 03:27:34 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/tomotsugu/code/Servo/#4c2104eb27a6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jul 13 03:27:34 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/resources/main.cpp	Mon Jul 13 03:27:34 2020 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+PwmOut pwm(p21);
+
+int main() {
+    int start= 0, end= 180;
+    while(1){
+        for(int p = start; p < end; p += 20 ) {
+            pwm.pulsewidth_us(p);
+            wait_ms(20);
+        }
+        for(int p = end; p >=start; p -= 20) {
+             pwm.pulsewidth_us(p);
+            wait_ms(20);
+        }
+    }
+}
\ No newline at end of file