Class Buzzer

    • Constructor Detail

      • Buzzer

        public Buzzer​(int gpio)
               throws RuntimeIOException
        Parameters:
        gpio - The GPIO to which the buzzer is attached to.
        Throws:
        RuntimeIOException - If an I/O error occurred.
      • Buzzer

        public Buzzer​(int gpio,
                      boolean activeHigh)
               throws RuntimeIOException
        Parameters:
        gpio - The GPIO to which the buzzer is attached to.
        activeHigh - Set to true if a high output value represents on.
        Throws:
        RuntimeIOException - If an I/O error occurred.
    • Method Detail

      • beep

        public void beep​(float onTime,
                         float offTime,
                         int n,
                         boolean background)
                  throws RuntimeIOException
        Beep.
        Parameters:
        onTime - On time in seconds.
        offTime - Off time in seconds.
        n - Number of iterations. Set to <0 to beep indefinitely
        background - If true start a background thread to control the blink and return immediately. If false, only return once the blink iterations have finished.
        Throws:
        RuntimeIOException - If an I/O error occurred.