Class PassiveBuzzerHelper
java.lang.Object
com.opensourcewithslu.outputdevices.PassiveBuzzerHelper
The PassiveBuzzerHelper class contains methods that pertain to the control of the passive buzzer.
-
Field Summary
Modifier and TypeFieldDescriptionprotected 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
ConstructorDescriptionPassiveBuzzerHelper
(com.pi4j.io.pwm.Pwm passiveBuzzer) The PassiveBuzzerHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Logs the passiveBuzzerFreq to the consolevoid
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 functionalityvoid
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
-
Field Details
-
passiveBuzzerFreq
protected int passiveBuzzerFreqpassiveBuzzerFreq is a protected integer variable that defines the default frequency for the buzzer. -
passBuzzDC
protected int passBuzzDCpassBuzzDC 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
- APwmConfiguration
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
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.
-