![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
my new gear...
Diff: actuator/Servomotor.hpp
- Revision:
- 2:e7b09385d197
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/actuator/Servomotor.hpp Sun Mar 27 04:39:16 2022 +0000 @@ -0,0 +1,27 @@ +#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*/ +}; \ No newline at end of file