servo unlock

Dependencies:   Servo mbed

Fork of Servo_HelloWorld by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
dll7
Date:
Mon Mar 13 03:30:40 2017 +0000
Parent:
1:40d2fd0b99e6
Child:
3:e80efe31284d
Commit message:
hoge

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
--- a/main.cpp	Tue Nov 23 16:10:35 2010 +0000
+++ b/main.cpp	Mon Mar 13 03:30:40 2017 +0000
@@ -3,11 +3,25 @@
 #include "mbed.h"
 #include "Servo.h"
 
-Servo myservo(p21);
+Servo servo(D6);
+InterruptIn button(D8);
+Serial pc(USBTX, USBRX); // tx, rx
+
+
+void rise(){
+  printf("rise");
+  servo = 0.0;
+}
 
-int main() {    
-    for(float p=0; p<1.0; p += 0.1) {
-        myservo = p;
-        wait(0.2);
-    }
+void fall(){
+  printf("fall");
+  servo = 1.0;
 }
+
+int main() {
+  printf("start");
+  servo.calibrate(0.0005, 45.0); 
+  button.mode(PullDown);
+  button.rise(&rise);
+  button.fall(&fall);
+}
--- a/mbed.bld	Tue Nov 23 16:10:35 2010 +0000
+++ b/mbed.bld	Mon Mar 13 03:30:40 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file