public class Buzzer extends DigitalOutputDevice
INFINITE_ITERATIONS
gpio
Constructor and Description |
---|
Buzzer(int gpio) |
Buzzer(int gpio,
boolean activeHigh) |
Modifier and Type | Method and Description |
---|---|
void |
beep()
Beep repeatedly in a background thread.
|
void |
beep(float onTime,
float offTime,
int n,
boolean background)
Beep.
|
close, isOn, off, on, onOffLoop, setOn, setValue, setValueUnsafe, toggle
getGpio
public Buzzer(int gpio) throws RuntimeIOException
gpio
- The GPIO to which the buzzer is attached to.RuntimeIOException
- If an I/O error occurred.public Buzzer(int gpio, boolean activeHigh) throws RuntimeIOException
gpio
- The GPIO to which the buzzer is attached to.activeHigh
- Set to true if a high output value represents on.RuntimeIOException
- If an I/O error occurred.public void beep() throws RuntimeIOException
RuntimeIOException
- If an I/O error occurred.public void beep(float onTime, float offTime, int n, boolean background) throws RuntimeIOException
onTime
- On time in seconds.offTime
- Off time in seconds.n
- Number of iterations. Set to <0 to beep indefinitelybackground
- If true start a background thread to control the blink and
return immediately. If false, only return once the blink
iterations have finished.RuntimeIOException
- If an I/O error occurred.Copyright © 2016–2017 mattjlewis. All rights reserved.