Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Tach
ContinuousServo.cpp
00001 #include "ContinuousServo.h" 00002 00003 //64 counts per rev 00004 00005 ContinuousServo::ContinuousServo(PinName output): servo_(output){ 00006 servo_.period_ms(50); 00007 } 00008 00009 void ContinuousServo::speed(float val){ 00010 //convert val from -1,1 to 1.3 to 1.7 00011 if(val<-1.0) 00012 val = -1.0; 00013 if(val>1.0) 00014 val = 1.0; 00015 servo_.pulsewidth_us((int)(1500+200*val)); 00016 } 00017 00018 void ContinuousServo::stop(){ 00019 servo_.pulsewidth_us(0); 00020 }
Generated on Sun Jul 17 2022 23:03:49 by
 1.7.2
 1.7.2