PowerSupply
This service is experimental and may change in the future.
A power supply with a fixed or variable voltage range
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
Registers
enabled
Turns the power supply on with true, off with false.
type:
Register<boolean>(packing formatu8)read and write
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.enabled.read()
await powerSupply.enabled.write(value)
- track incoming values
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
powerSupply.enabled.subscribe(async (value) => {
...
})
write and read will block until a server is bound to the client.
outputVoltage
The current output voltage of the power supply. Values provided must be in the range minimum_voltage to maximum_voltage
type:
Register<number>(packing formatf64)read and write
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.outputVoltage.read()
await powerSupply.outputVoltage.write(value)
- track incoming values
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
powerSupply.outputVoltage.subscribe(async (value) => {
...
})
write and read will block until a server is bound to the client.
minValue
The minimum output voltage of the power supply. For fixed power supplies, minimum_voltage should be equal to maximum_voltage.
type:
Register<number>(packing formatf64)constant: the register value will not change (until the next reset)
read only
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.minValue.read()
write and read will block until a server is bound to the client.
maxValue
The maximum output voltage of the power supply. For fixed power supplies, minimum_voltage should be equal to maximum_voltage.
type:
Register<number>(packing formatf64)constant: the register value will not change (until the next reset)
read only
import { PowerSupply } from "@devicescript/core"
const powerSupply = new PowerSupply()
// ...
const value = await powerSupply.maxValue.read()
write and read will block until a server is bound to the client.