my new gear...

Dependencies:   mbed

actuator/Servomotor.hpp

Committer:
yootee
Date:
22 months ago
Revision:
22:394337a4205a
Parent:
2:e7b09385d197

File content as of revision 22:394337a4205a:

#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*/
};