Y2KB040Buzzer (y2kb040buzzer v0.1.0)

Copy Markdown

Driver for the Y2KB-040 I2C buzzer/melody module (I2C address 0x16 by default).

Summary

Functions

Closes the I2C bus reference returned by open/1.

Opens the I2C bus the buzzer is on.

Functions

beep(ref, pitch, length, times, i2c_address \\ 22)

Sounds the buzzer.

  • pitch - the note to play, 1-7
  • length - the note duration, 0-3
  • times - the repeat count, 0-3
  • i2c_address - defaults to 0x16

close(ref)

Closes the I2C bus reference returned by open/1.

open(bus_name \\ "i2c-2")

Opens the I2C bus the buzzer is on.