SmartServo()

SmartServo sensor module

Extends

  • Electronic

Members

protocol

getter of protocol

Methods

absoluteAngle(angle)

Move to the absolute angle

Parameters:
Name Type Description
angle Number

the absolute angle

backToStart()

回到起点

Returns:

async getData() → {Promise}

Get data of read API such as readSpeed, readVoltage, readAngle and so on

Returns:
Promise
Example
mcore.SmartServo(1)
     .readSpeed()
     .getData()
     .then((val) => {
       console.log(val)
      });

handshake()

handshake

ledColor(hex_rgb)

set led color of the smart servo

Parameters:
Name Type Description
hex_rgb String | Array

#ff0064 or [255, 00, 100]

lock()

锁定

Returns:

readAngle()

读角度

readCurrent()

读电流

readSpeed()

读速度

readTemperature()

读温度

readVoltage()

读电压

relativeAngle(angle)

Move to the relative angle

Parameters:
Name Type Description
angle Number

the relative angle

run() → {Instance}

run of write API such as speed, runAsDcMotor, setZeroPoint and so on

Returns:
Instance -

@this

Example
mcore.SmartServo(1)
     .speed()
     .run()

setAsDCMotorSpeed(speed)

set speed of smart servo as a DC motor

Parameters:
Name Type Description
speed Number

(optional) speed of the smart servo

setZeroPoint()

设置零点

speed(speed)

Set speed for smart servo

Parameters:
Name Type Description
speed Number

the speed

unclock()

解锁

Returns: