Servo control for shield NMHU (New Mexico Highlands University) KL-46Z. This will control two servos. at the same time back and forth.

Dependencies:   Servo mbed

Committer:
bomalley
Date:
Thu Mar 12 18:31:10 2015 +0000
Revision:
0:6138ceae43f5
Servo control for shield NMHU (New Mexico Highlands University) KL-46Z.; This will control two servos. at the same time back and forth.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bomalley 0:6138ceae43f5 1 #include "mbed.h"
bomalley 0:6138ceae43f5 2 #include "Servo.h"
bomalley 0:6138ceae43f5 3
bomalley 0:6138ceae43f5 4 #define WAITTIME 0.2
bomalley 0:6138ceae43f5 5
bomalley 0:6138ceae43f5 6 /*
bomalley 0:6138ceae43f5 7 * Written by: Bresdin O'Malley 2015
bomalley 0:6138ceae43f5 8 * Servo control for shield NMHU (New Mexico Highlands University) KL-46Z.
bomalley 0:6138ceae43f5 9 * This will control two servos.
bomalley 0:6138ceae43f5 10
bomalley 0:6138ceae43f5 11 */
bomalley 0:6138ceae43f5 12
bomalley 0:6138ceae43f5 13 Servo myservo1(PTC9);
bomalley 0:6138ceae43f5 14 Servo myservo2(PTC8);
bomalley 0:6138ceae43f5 15
bomalley 0:6138ceae43f5 16 int main() {
bomalley 0:6138ceae43f5 17 while(true) {
bomalley 0:6138ceae43f5 18 for(float p=0; p<1.0; p += 0.1) {
bomalley 0:6138ceae43f5 19 myservo1.write(p);
bomalley 0:6138ceae43f5 20 myservo2.write(p);
bomalley 0:6138ceae43f5 21 wait(WAITTIME);
bomalley 0:6138ceae43f5 22 }
bomalley 0:6138ceae43f5 23 }
bomalley 0:6138ceae43f5 24 }