f

Dependencies:   Servo mbed

Committer:
EpicG10
Date:
Wed Apr 12 12:33:34 2017 +0000
Revision:
1:871a9b15f62f
Parent:
0:f537081d4282
s

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EpicG10 0:f537081d4282 1
EpicG10 0:f537081d4282 2 // Continuously sweep the servo through it's full range
EpicG10 0:f537081d4282 3 #include <mbed.h>
EpicG10 0:f537081d4282 4 #include "Servo.h"
EpicG10 0:f537081d4282 5
EpicG10 0:f537081d4282 6 Servo myservo(PC_7);
EpicG10 0:f537081d4282 7
EpicG10 0:f537081d4282 8 int main()
EpicG10 0:f537081d4282 9 {
EpicG10 0:f537081d4282 10 myservo.calibrate(0.0015, 180.0);
EpicG10 0:f537081d4282 11 while(1) {
EpicG10 0:f537081d4282 12
EpicG10 0:f537081d4282 13 for(int i=0; i<135; i+=1) {
EpicG10 1:871a9b15f62f 14 myservo.position(65-(float)i);
EpicG10 0:f537081d4282 15 wait(0.04);
EpicG10 0:f537081d4282 16
EpicG10 0:f537081d4282 17 }
EpicG10 0:f537081d4282 18 for(int i=0; i<135; i+=1) {
EpicG10 1:871a9b15f62f 19 myservo.position(-70.0+(float)i);
EpicG10 0:f537081d4282 20 wait(0.04);
EpicG10 0:f537081d4282 21 }
EpicG10 0:f537081d4282 22
EpicG10 0:f537081d4282 23
EpicG10 0:f537081d4282 24 }
EpicG10 0:f537081d4282 25 }