![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
my new gear...
actuator/Servomotor.hpp@2:e7b09385d197, 2022-03-27 (annotated)
- Committer:
- yootee
- Date:
- Sun Mar 27 04:39:16 2022 +0000
- Revision:
- 2:e7b09385d197
arrc?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yootee | 2:e7b09385d197 | 1 | #pragma once |
yootee | 2:e7b09385d197 | 2 | #include<mbed.h> |
yootee | 2:e7b09385d197 | 3 | #include<PwmOut.h> |
yootee | 2:e7b09385d197 | 4 | #include<portSet.hpp> |
yootee | 2:e7b09385d197 | 5 | |
yootee | 2:e7b09385d197 | 6 | /*パルスの単位はusでよろ*/ |
yootee | 2:e7b09385d197 | 7 | /* |
yootee | 2:e7b09385d197 | 8 | | range degree | pulse cycle | min pulse | max pulse | |
yootee | 2:e7b09385d197 | 9 | DS3218 |180(270もある) | 20000 | 500 | 2500 | |
yootee | 2:e7b09385d197 | 10 | SG90 | 180 | 20000 | 1000 | 2000 | |
yootee | 2:e7b09385d197 | 11 | */ |
yootee | 2:e7b09385d197 | 12 | class servo |
yootee | 2:e7b09385d197 | 13 | { |
yootee | 2:e7b09385d197 | 14 | public: |
yootee | 2:e7b09385d197 | 15 | servo(PinName signal,unsigned int range_degree,unsigned int pulse_cycle,unsigned int min_pulse,unsigned int max_pulse); |
yootee | 2:e7b09385d197 | 16 | void Setangle(unsigned int tar_angle); |
yootee | 2:e7b09385d197 | 17 | void Addangle(int tar_angle); |
yootee | 2:e7b09385d197 | 18 | float pulsese; |
yootee | 2:e7b09385d197 | 19 | private: |
yootee | 2:e7b09385d197 | 20 | PinName signal_; |
yootee | 2:e7b09385d197 | 21 | unsigned int range_degree_; |
yootee | 2:e7b09385d197 | 22 | unsigned int pulse_cycle_; |
yootee | 2:e7b09385d197 | 23 | unsigned int min_pulse_; |
yootee | 2:e7b09385d197 | 24 | unsigned int max_pulse_; |
yootee | 2:e7b09385d197 | 25 | unsigned int now_angle_; |
yootee | 2:e7b09385d197 | 26 | double pdp;/*pulse per degree*/ |
yootee | 2:e7b09385d197 | 27 | }; |