obniz Parts Library

Keyestudio_Buzzer

GitHub
Keyestudio_Buzzer
Usable Devices :
obniz_board

Keyestudio_Buzzer

Keyestudio buzzer. It make a specified sound.

wired(obniz, { signal [, vcc, gnd]});

name type required default description
signal number(obniz Board io) yes   signal output pin(s pin of Keyestudio)
vcc number(obniz Board io) no   VCC(+ pin of Keyestudio)
gnd number(obniz Board io) no   GND(- pin of Keyestudio)
// Javascript Example
var speaker = obniz.wired("Keyestudio_Buzzer", {signal:0, vcc:1, gnd:2});
speaker.play(1000) // 1000 Hz

play(frequency)

Specify the frequency of the sound from the speaker.

// Javascript Example
var speaker = obniz.wired("Keyestudio_Buzzer", {signal:0, vcc:1, gnd:2});
speaker.play(1000) // 1000 Hz

stop()

再生を停止します。

// Javascript Example
var speaker = obniz.wired("Keyestudio_Buzzer", {signal:0, vcc:1, gnd:2});
speaker.play(1000) // 1000 Hz
await obniz.wait(1000);
speaker.stop();

Supported from: obniz.js 3.5.0