Motor
This service is rc and may change in the future.
A DC motor.
import { Motor } from "@devicescript/core"
const motor = new Motor()
Registers
speed
Relative speed of the motor. Use positive/negative values to run the motor forwards and backwards.
Positive is recommended to be clockwise rotation and negative counterclockwise. A speed of 0
while enabled
acts as brake.
type:
Register<number>
(packing formati1.15
)read and write
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
const value = await motor.speed.read()
await motor.speed.write(value)
- track incoming values
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
motor.speed.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
enabled
Turn the power to the motor on/off.
type:
Register<boolean>
(packing formatu8
)read and write
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
const value = await motor.enabled.read()
await motor.enabled.write(value)
- track incoming values
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
motor.enabled.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
loadTorque
Torque required to produce the rated power of an electrical motor at load speed.
type:
Register<number>
(packing formatu16.16
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
const value = await motor.loadTorque.read()
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 formatu16.16
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
const value = await motor.loadRotationSpeed.read()
write
and read
will block until a server is bound to the client.
reversible
Indicates if the motor can run backwards.
type:
Register<boolean>
(packing formatu8
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { Motor } from "@devicescript/core"
const motor = new Motor()
// ...
const value = await motor.reversible.read()
write
and read
will block until a server is bound to the client.