Preston Stephens / Mbed 2 deprecated MiniProject5_LightTracker

Dependencies:   mbed

Fork of MiniProject5_LightTracker by Austin Sloop

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ServoControl.cpp Source File

ServoControl.cpp

00001 //Control Function for servo
00002 
00003 #include "ServoControl.h"
00004 
00005 PwmOut ServoSignal(p21);            //P21 is PWM signal out to servo 
00006 
00007 void ServoInit(void){
00008     ServoSignal.period(0.020);
00009 }
00010 
00011 int ServoControl(signed int angle){
00012     if(angle<-90){angle=-89;}
00013     if(angle>90){angle=89;}
00014     ServoSignal.pulsewidth_us(1500+10*angle); 
00015     return angle;
00016 }
00017     
00018 
00019