Buzzer
caution
This service is rc and may change in the future.
A simple buzzer.
import { Buzzer } from "@devicescript/core"
const buzzer = new Buzzer()
Commands
playNote
Play a note at the given frequency and volume.
buzzer.playNote(frequency: number, volume: number, duration: number): Promise<void>
Registers
intensity
The volume (duty cycle) of the buzzer.
type:
Register<number>
(packing formatu0.8
)read and write
import { Buzzer } from "@devicescript/core"
const buzzer = new Buzzer()
// ...
const value = await buzzer.intensity.read()
await buzzer.intensity.write(value)
- track incoming values
import { Buzzer } from "@devicescript/core"
const buzzer = new Buzzer()
// ...
buzzer.intensity.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.