public class BrickletPiezoSpeaker extends Device
Modifier and Type | Class and Description |
---|---|
static interface |
BrickletPiezoSpeaker.BeepFinishedListener
This listener is triggered if a beep set by
beep(long, int) is finished |
static interface |
BrickletPiezoSpeaker.MorseCodeFinishedListener
This listener is triggered if the playback of the morse code set by
morseCode(String, int) is finished. |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static long |
BEEP_DURATION_INFINITE |
static long |
BEEP_DURATION_OFF |
static String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_BEEP |
static byte |
FUNCTION_CALIBRATE |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_MORSE_CODE |
Constructor and Description |
---|
BrickletPiezoSpeaker(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addBeepFinishedListener(BrickletPiezoSpeaker.BeepFinishedListener listener)
Adds a BeepFinished listener.
|
void |
addMorseCodeFinishedListener(BrickletPiezoSpeaker.MorseCodeFinishedListener listener)
Adds a MorseCodeFinished listener.
|
void |
beep(long duration,
int frequency)
Beeps with the given frequency for the given duration.
|
boolean |
calibrate()
The Piezo Speaker Bricklet can play 512 different tones.
|
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
void |
morseCode(String morse,
int frequency)
Sets morse code that will be played by the piezo buzzer.
|
void |
removeBeepFinishedListener(BrickletPiezoSpeaker.BeepFinishedListener listener)
Removes a BeepFinished listener.
|
void |
removeMorseCodeFinishedListener(BrickletPiezoSpeaker.MorseCodeFinishedListener listener)
Removes a MorseCodeFinished listener.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_BEEP
public static final byte FUNCTION_MORSE_CODE
public static final byte FUNCTION_CALIBRATE
public static final byte FUNCTION_GET_IDENTITY
public static final long BEEP_DURATION_OFF
public static final long BEEP_DURATION_INFINITE
public BrickletPiezoSpeaker(String uid, IPConnection ipcon)
public void beep(long duration, int frequency) throws TinkerforgeException
calibrate()
).TinkerforgeException
public void morseCode(String morse, int frequency) throws TinkerforgeException
TinkerforgeException
public boolean calibrate() throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addBeepFinishedListener(BrickletPiezoSpeaker.BeepFinishedListener listener)
public void removeBeepFinishedListener(BrickletPiezoSpeaker.BeepFinishedListener listener)
public void addMorseCodeFinishedListener(BrickletPiezoSpeaker.MorseCodeFinishedListener listener)
public void removeMorseCodeFinishedListener(BrickletPiezoSpeaker.MorseCodeFinishedListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.