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.
Fork of BX-car_2 by
servo_api.cpp
00001 // 0~180 angle 1~2ms 00002 #include "mbed.h" 00003 #include "servo_api.h" 00004 #define right_end 0.093 //90 00005 #define left_end 0.061 //-90 00006 00007 //memory opt 00008 // 5 degree seperate 00009 BX_servo::BX_servo(void) 00010 { 00011 angle = 0; 00012 servo_in= new PwmOut(PTB0); 00013 servo_in->period_ms(20); 00014 } 00015 00016 float BX_servo::set_angle(float a) 00017 { 00018 00019 if( a<left_end ) 00020 a=left_end; 00021 else if(a>right_end) 00022 a=right_end; 00023 angle=a; 00024 *servo_in=angle; 00025 00026 return angle; 00027 }
Generated on Tue Jul 12 2022 21:33:29 by
 1.7.2
 1.7.2 
    