Developer

First

KeiganMotor is controllable by sending bytes array.
We call a task by sending command data as "Task" .

byte [0] [1][2] [3]...[n-3] [n-2] [n-1]
value 0x00-0xFF uint16_t identifier values uint16_t crc16
Desc. command identifier arguments
(Its length varies with command)
CRC16
Error-detecting code

 

Unit System

KeiganMotor adopts the folowing unit system.

value unit
position radian
velocity or speed radian / second
torque N * m (Newton * meter)

Reference link: float-binary converter
http://www.binaryconvert.com/convert_float.html

 

Example of bytes command

KeiganMotor KM-1 is controlled by sending bytes array via Bluetooth Low Energy or I2C and USB.
For example, simple motion control is like follows.

It is okay to set id or crc16 to any value.

 

(Task 1)

Enable motor action (enable command: 0x51)

byte[0] byte[1] byte[2] byte[3] byte[4]
0x51 0 0 0 0

(Task 2)

Set motor speed (speed command: 0x58)

byte[0] byte[1] byte[2] byte[3] byte[4] byte[5] byte[6] byte[7] byte[8]
0x58 0x00 0x01 0x3F 0x80 0x00 0x00 0x00 0x00

From byte[3] to [6] means (float)1.0 = 0x3F800000.
This command gives 1.0 radian/second speed to the motor. 
(1 radian / second ≒ 9.55 rpm)

(Task 3)

Run forward  (runForward command: 0x60)

byte[0] byte[1] byte[2] byte[3] byte[4]
0x60 0x00 0x02 0x00 0x00