Class PassiveBuzzerHelper

java.lang.Object
com.opensourcewithslu.outputdevices.PassiveBuzzerHelper

public class PassiveBuzzerHelper extends Object
The PassiveBuzzerHelper class contains methods that pertain to the control of the passive buzzer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    passBuzzDC is a protected integer variable that defines the duty cycle.
    protected int
    passiveBuzzerFreq is a protected integer variable that defines the default frequency for the buzzer.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PassiveBuzzerHelper(com.pi4j.io.pwm.Pwm passiveBuzzer)
    The PassiveBuzzerHelper constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Logs the passiveBuzzerFreq to the console
    void
    Disables the passive buzzer.
    void
    passiveBuzzerOn(int passBuzzDC, int passiveBuzzerFreq)
    Sets the passive buzzer to the desired duty cycle and frequency.
    void
    passiveBuzzTone emits a 1 - second buzz to ensure functionality
    void
    Tone sequence cycles through array's containing the frequencies of the first then digits of pi.
    void
    setFrequencies(File frequenciesFile)
    Allows users to pipe in a text file of frequencies separated by commas to play on the passive buzzer.
    void
    freChangeTest cycles through frequencies to verify that frequencies are changing

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • passiveBuzzerFreq

      protected int passiveBuzzerFreq
      passiveBuzzerFreq is a protected integer variable that defines the default frequency for the buzzer.
    • passBuzzDC

      protected int passBuzzDC
      passBuzzDC is a protected integer variable that defines the duty cycle. When set at 50% the buzzer is in a half on and half off state.
  • Constructor Details

    • PassiveBuzzerHelper

      public PassiveBuzzerHelper(com.pi4j.io.pwm.Pwm passiveBuzzer)
      The PassiveBuzzerHelper constructor.
      Parameters:
      passiveBuzzer - A PwmConfiguration Object.
  • Method Details

    • passiveBuzzerOn

      public void passiveBuzzerOn(int passBuzzDC, int passiveBuzzerFreq)
      Sets the passive buzzer to the desired duty cycle and frequency.
      Parameters:
      passBuzzDC - sets the passive buzzer to the desired duty cycle.
      passiveBuzzerFreq - sets the passive buzzer to the desired frequency.
    • passiveBuzzerOff

      public void passiveBuzzerOff()
      Disables the passive buzzer. Effectively silencing it.
    • getFrequency

      public void getFrequency()
      Logs the passiveBuzzerFreq to the console
    • setFrequencies

      public void setFrequencies(File frequenciesFile)
      Allows users to pipe in a text file of frequencies separated by commas to play on the passive buzzer.
      Parameters:
      frequenciesFile - The file containing the frequencies to be played
    • passiveBuzzTone

      public void passiveBuzzTone()
      passiveBuzzTone emits a 1 - second buzz to ensure functionality
    • toneIterator

      public void toneIterator()
      freChangeTest cycles through frequencies to verify that frequencies are changing
    • piToneSequence

      public void piToneSequence()
      Tone sequence cycles through array's containing the frequencies of the first then digits of pi.