Dependencies:   Servo mbed

Committer:
jordaahh
Date:
Tue Feb 07 13:25:10 2017 +0000
Revision:
0:b5ce567b469c
Child:
2:baf8a7b2b150
Algorithm in main is used to control a single servo with potentiometer. Function prototypes for the automated control have been added in as well.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jordaahh 0:b5ce567b469c 1 // Hello World to sweep a servo through its full range
jordaahh 0:b5ce567b469c 2
jordaahh 0:b5ce567b469c 3 #include "mbed.h"
jordaahh 0:b5ce567b469c 4 #include "Servo.h"
jordaahh 0:b5ce567b469c 5 #include "SystemFunctions.h"
jordaahh 0:b5ce567b469c 6
jordaahh 0:b5ce567b469c 7
jordaahh 0:b5ce567b469c 8 int main() {
jordaahh 0:b5ce567b469c 9
jordaahh 0:b5ce567b469c 10 servo1.calibrate(range, 45.0); // *****check this fucntion******
jordaahh 0:b5ce567b469c 11
jordaahh 0:b5ce567b469c 12 while(1){
jordaahh 0:b5ce567b469c 13 // initial code for testing one servo with a linear potentiometer.
jordaahh 0:b5ce567b469c 14 position = pot;
jordaahh 0:b5ce567b469c 15 wait_ms(0.5);
jordaahh 0:b5ce567b469c 16 servo1 = position;
jordaahh 0:b5ce567b469c 17 }
jordaahh 0:b5ce567b469c 18 }
jordaahh 0:b5ce567b469c 19