Skip to main content

DualMotors

caution

This service is experimental and may change in the future.

A synchronized pair of motors.

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()

Registers

speed

Relative speed of the motors. Use positive/negative values to run the motor forwards and backwards. A speed of 0 while enabled acts as brake.

  • type: Register<any[]> (packing format i1.15 i1.15)

  • track incoming values

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
dualMotors.speed.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

enabled

Turn the power to the motors on/off.

  • type: Register<boolean> (packing format u8)

  • read and write

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.enabled.read()
await dualMotors.enabled.write(value)
  • track incoming values
import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
dualMotors.enabled.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

loadTorque

Torque required to produce the rated power of an each electrical motor at load speed.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.loadTorque.read()
note

write and read will block until a server is bound to the client.

loadRotationSpeed

Revolutions per minute of the motor under full load.

  • type: Register<number> (packing format u16.16)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.loadRotationSpeed.read()
note

write and read will block until a server is bound to the client.

reversible

Indicates if the motors can run backwards.

  • type: Register<boolean> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { DualMotors } from "@devicescript/core"

const dualMotors = new DualMotors()
// ...
const value = await dualMotors.reversible.read()
note

write and read will block until a server is bound to the client.