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
FieldsModifier and TypeFieldDescriptionprotected intpassBuzzDC is a protected integer variable that defines the duty cycle.protected intpassiveBuzzerFreq is a protected integer variable that defines the default frequency for the buzzer. -
Constructor Summary
ConstructorsConstructorDescriptionPassiveBuzzerHelper(com.pi4j.io.pwm.Pwm passiveBuzzer) The PassiveBuzzerHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidLogs the passiveBuzzerFreq to the consolevoidDisables the passive buzzer.voidpassiveBuzzerOn(int passBuzzDC, int passiveBuzzerFreq) Sets the passive buzzer to the desired duty cycle and frequency.voidpassiveBuzzTone emits a 1 - second buzz to ensure functionalityvoidTone sequence cycles through array's containing the frequencies of the first then digits of pi.voidsetFrequencies(File frequenciesFile) Allows users to pipe in a text file of frequencies separated by commas to play on the passive buzzer.voidfreChangeTest 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- APwmConfigurationObject.
-
-
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.
-