Solenoid
caution
This service is rc and may change in the future.
A push-pull solenoid is a type of relay that pulls a coil when activated.
import { Solenoid } from "@devicescript/core"
const solenoid = new Solenoid()
Registers
enabled
Indicates whether the solenoid is energized and pulled (on) or pushed (off).
type:
Register<boolean>
(packing formatu8
)read and write
import { Solenoid } from "@devicescript/core"
const solenoid = new Solenoid()
// ...
const value = await solenoid.enabled.read()
await solenoid.enabled.write(value)
- track incoming values
import { Solenoid } from "@devicescript/core"
const solenoid = new Solenoid()
// ...
solenoid.enabled.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.
variant
Describes the type of solenoid used.
type:
Register<number>
(packing formatu8
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { Solenoid } from "@devicescript/core"
const solenoid = new Solenoid()
// ...
const value = await solenoid.variant.read()
note
write
and read
will block until a server is bound to the client.