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.
KrsServo.h
00001 #include "SerialHalfDuplex.h" 00002 00003 class KrsServo 00004 { 00005 public: 00006 /** 00007 * コンストラクタ 00008 * @param TX NCで接続しない 00009 * @param RX NCで接続しない 00010 * @param servoID 接続するサーボID 00011 * @param baudrate defaultだと115200bps 00012 **/ 00013 KrsServo(PinName tx,PinName rx,int servoID,int baudrate = 115200); 00014 00015 /** 00016 * サーボに角度を指令する 00017 * @param postion 指令するポジションの値 00018 * @return 現在のポジションの値 00019 **/ 00020 int setPosition(int postion); 00021 /** 00022 * サーボを脱力して現在のサーボの角度をポジションで受け取る 00023 * @return 現在のポジションの値 00024 **/ 00025 int setFree(); 00026 /** 00027 * サーボに角度を指令する 00028 * @param 指令する角度の値 00029 * @return 現在のポジションの値 00030 **/ 00031 int setAngle(float deg); 00032 00033 /** 00034 * サーボの角度をポジションで取得する(ICS.3.6のみ) 00035 * @return 現在のポジションの値 00036 **/ 00037 int getPosition(); 00038 00039 /** 00040 * サーボの角度を弧度で取得する(ICS.3.6のみ) 00041 * @return 現在のポジション(弧度)の値 00042 **/ 00043 int getAngle(); 00044 00045 float pos2deg(int position); 00046 int deg2pos(float deg); 00047 int setSpeed(unsigned int speed); 00048 private: 00049 SerialHalfDuplex ics; 00050 bool write(unsigned char *txData,int txLen,unsigned char *rxData,int rxLen); 00051 int _servoID; 00052 };
Generated on Mon Jul 18 2022 09:48:53 by
1.7.2