PlanarPosition
This service is experimental and may change in the future.
A sensor that repors 2D position, typically an optical mouse tracking sensor.
The sensor starts at an arbitrary origin (0,0) and reports the distance from that origin.
The streaming_interval
is respected when the position is changing. When the position is not changing, the streaming interval may be throttled to 500ms
.
import { PlanarPosition } from "@devicescript/core"
const planarPosition = new PlanarPosition()
Registers
reading
The current position of the sensor.
type:
Register<any[]>
(packing formati22.10 i22.10
)track incoming values
import { PlanarPosition } from "@devicescript/core"
const planarPosition = new PlanarPosition()
// ...
planarPosition.reading.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
variant
Specifies the type of physical sensor.
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 { PlanarPosition } from "@devicescript/core"
const planarPosition = new PlanarPosition()
// ...
const value = await planarPosition.variant.read()
write
and read
will block until a server is bound to the client.