TCP/IP - Piezo Buzzer Bricklet

This is the description of the TCP/IP protocol for the Piezo Buzzer Bricklet. General information and technical specifications for the Piezo Buzzer Bricklet are summarized in its hardware description.

API

A general description of the TCP/IP protocol structure can be found here.

Basic Functions

BrickletPiezoBuzzer.beep
Function ID:
  • 1
Request:
  • duration – Type: uint32, Unit: 1 ms, Range: [0 to 232 - 1]
Response:
  • no response

Beeps for the given duration.

BrickletPiezoBuzzer.morse_code
Function ID:
  • 2
Request:
  • morse – Type: char[60]
Response:
  • no response

Sets morse code that will be played by the piezo buzzer. The morse code is given as a string consisting of "." (dot), "-" (minus) and " " (space) for dits, dahs and pauses. Every other character is ignored.

For example: If you set the string "...---...", the piezo buzzer will beep nine times with the durations "short short short long long long short short short".

Advanced Functions

BrickletPiezoBuzzer.get_identity
Function ID:
  • 255
Request:
  • empty payload
Response:
  • uid – Type: char[8]
  • connected_uid – Type: char[8]
  • position – Type: char, Range: ['a' to 'h', 'z']
  • hardware_version – Type: uint8[3]
    • 0: major – Type: uint8, Range: [0 to 255]
    • 1: minor – Type: uint8, Range: [0 to 255]
    • 2: revision – Type: uint8, Range: [0 to 255]
  • firmware_version – Type: uint8[3]
    • 0: major – Type: uint8, Range: [0 to 255]
    • 1: minor – Type: uint8, Range: [0 to 255]
    • 2: revision – Type: uint8, Range: [0 to 255]
  • device_identifier – Type: uint16, Range: [0 to 216 - 1]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here

Callbacks

BrickletPiezoBuzzer.CALLBACK_BEEP_FINISHED
Function ID:
  • 3
Response:
  • empty payload

This callback is triggered if a beep set by beep is finished

BrickletPiezoBuzzer.CALLBACK_MORSE_CODE_FINISHED
Function ID:
  • 4
Response:
  • empty payload

This callback is triggered if the playback of the morse code set by morse_code is finished.