Multitouch
This service is experimental and may change in the future.
A capacitive touch sensor with multiple inputs.
import { Multitouch } from "@devicescript/core"
const multitouch = new Multitouch()
Registers
reading
Capacitance of channels. The capacitance is continuously calibrated, and a value of 0
indicates
no touch, wheres a value of around 100
or more indicates touch.
It's best to ignore this (unless debugging), and use events.
Digital sensors will use 0
or 0xffff
on each channel.
type:
Register<any[]>
(packing formatr: i16
)track incoming values
import { Multitouch } from "@devicescript/core"
const multitouch = new Multitouch()
// ...
multitouch.reading.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
Events
touch
Emitted when an input is touched.
multitouch.touch.subscribe(() => {
})
release
Emitted when an input is no longer touched.
multitouch.release.subscribe(() => {
})
tap
Emitted when an input is briefly touched. TODO Not implemented.
multitouch.tap.subscribe(() => {
})
longPress
Emitted when an input is touched for longer than 500ms. TODO Not implemented.
multitouch.longPress.subscribe(() => {
})
swipePos
Emitted when input channels are successively touched in order of increasing channel numbers.
multitouch.swipePos.subscribe(() => {
})
swipeNeg
Emitted when input channels are successively touched in order of decreasing channel numbers.
multitouch.swipeNeg.subscribe(() => {
})