![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
my new gear...
actuator/Servomotor.hpp
- Committer:
- yootee
- Date:
- 2022-03-27
- Revision:
- 2:e7b09385d197
File content as of revision 2:e7b09385d197:
#pragma once #include<mbed.h> #include<PwmOut.h> #include<portSet.hpp> /*パルスの単位はusでよろ*/ /* | range degree | pulse cycle | min pulse | max pulse | DS3218 |180(270もある) | 20000 | 500 | 2500 | SG90 | 180 | 20000 | 1000 | 2000 | */ class servo { public: servo(PinName signal,unsigned int range_degree,unsigned int pulse_cycle,unsigned int min_pulse,unsigned int max_pulse); void Setangle(unsigned int tar_angle); void Addangle(int tar_angle); float pulsese; private: PinName signal_; unsigned int range_degree_; unsigned int pulse_cycle_; unsigned int min_pulse_; unsigned int max_pulse_; unsigned int now_angle_; double pdp;/*pulse per degree*/ };