KRS ICSサーボモータ用ライブラリ
初期化 KRS name(tx,rx);
位置指定 void SetPosition(id, position); [position : 0 3500 ~ 11500]
速度設定 void SetSpeed(id, speed); [speed : 0 ~ 127]
ストレッチ設定 void SetStretch(id, stretch); [stretch : 0 ~ 127]
電流制限設定 void SetCurrent(id, rotate, value : 0 ~ 127); [rotate : KRS::F KRS::R KRS::COM, current : 0 ~ 64]
ID書き込み void WriteAddress(id);
id : 0x00 ~ 0x1F
KRS.h@2:431a802d01e2, 2022-07-03 (annotated)
- Committer:
- koki_konishi
- Date:
- Sun Jul 03 05:11:26 2022 +0000
- Revision:
- 2:431a802d01e2
- Parent:
- 1:50d0eb774b0d
Kondo-servo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
koki_konishi | 0:7bf595a76895 | 1 | #ifndef MBED_KRS_H |
koki_konishi | 0:7bf595a76895 | 2 | #define MBED_KRS_H |
koki_konishi | 0:7bf595a76895 | 3 | |
koki_konishi | 0:7bf595a76895 | 4 | #include "mbed.h" |
koki_konishi | 0:7bf595a76895 | 5 | |
koki_konishi | 0:7bf595a76895 | 6 | class KRS{ |
koki_konishi | 0:7bf595a76895 | 7 | public: |
koki_konishi | 1:50d0eb774b0d | 8 | typedef enum ROTATE { |
koki_konishi | 1:50d0eb774b0d | 9 | F, |
koki_konishi | 1:50d0eb774b0d | 10 | R, |
koki_konishi | 1:50d0eb774b0d | 11 | COM |
koki_konishi | 1:50d0eb774b0d | 12 | } ROTATE; |
koki_konishi | 1:50d0eb774b0d | 13 | |
koki_konishi | 0:7bf595a76895 | 14 | KRS(PinName tx,PinName rx); |
koki_konishi | 0:7bf595a76895 | 15 | |
koki_konishi | 2:431a802d01e2 | 16 | void KRS::WriteAddress(uint8_t address); |
koki_konishi | 2:431a802d01e2 | 17 | |
koki_konishi | 1:50d0eb774b0d | 18 | void KRS::SetStretch(uint8_t address, uint8_t value); |
koki_konishi | 1:50d0eb774b0d | 19 | |
koki_konishi | 1:50d0eb774b0d | 20 | void KRS::SetSpeed(uint8_t address, uint8_t value); |
koki_konishi | 1:50d0eb774b0d | 21 | |
koki_konishi | 1:50d0eb774b0d | 22 | void KRS::SetCurrent(uint8_t address, ROTATE rotate, uint8_t value); |
koki_konishi | 1:50d0eb774b0d | 23 | |
koki_konishi | 0:7bf595a76895 | 24 | void KRS::SetPosition(uint8_t address, uint16_t value); |
koki_konishi | 0:7bf595a76895 | 25 | |
koki_konishi | 0:7bf595a76895 | 26 | private: |
koki_konishi | 0:7bf595a76895 | 27 | Serial _serial; |
koki_konishi | 0:7bf595a76895 | 28 | }; |
koki_konishi | 0:7bf595a76895 | 29 | |
koki_konishi | 0:7bf595a76895 | 30 | #endif |