Jump to content

Component: Buzzer (Audio Output): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(10 intermediate revisions by 2 users not shown)
Line 22: Line 22:


==Detailed description==
==Detailed description==




Line 48: Line 50:


==Examples==
==Examples==




Line 91: Line 95:
{{Fcfile|Basic Buzzer Example.fcfx|Basic Buzzer Example}}
{{Fcfile|Basic Buzzer Example.fcfx|Basic Buzzer Example}}


==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerBeep'''
|-
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OnTime
|-
| colspan="2" | Length of time in ms the buzzer will remain on 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OffTime
|-
| colspan="2" | Length of time in ms the buzzer will remain off 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumberLoops
|-
| colspan="2" | Number of times to repeat the sequence. Range 1-255 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOff'''
|-
| colspan="2" | Switch Off the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOn'''
|-
| colspan="2" | Switch On the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOnDelay'''
|-
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Time
|-
| colspan="2" | Time in milliseconds to keep the buzzer on 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}








==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
==Macro reference==
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Output Pin
|-
| colspan="2" | Pin used to drive the output to the buzzer 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Polarity
|-
| colspan="2" | Controls the pin state required to switch the buzzer on. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Buzzer Frequency
|-
| colspan="2" | Frequency of the buzzer in Hz to drive the simulation 
|}==Macro reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerBeep'''
|-
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OnTime
|-
| colspan="2" | Length of time in ms the buzzer will remain on 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OffTime
|-
| colspan="2" | Length of time in ms the buzzer will remain off 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumberLoops
|-
| colspan="2" | Number of times to repeat the sequence. Range 1-255 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOff'''
|-
| colspan="2" | Switch Off the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOn'''
|-
| colspan="2" | Switch On the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOnDelay'''
|-
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Time
|-
| colspan="2" | Time in milliseconds to keep the buzzer on 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
 
 
==Property reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Output Pin
|-
| colspan="2" | Pin used to drive the output to the buzzer 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Polarity
|-
| colspan="2" | Controls the pin state required to switch the buzzer on. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Buzzer Frequency
|-
| colspan="2" | Frequency of the buzzer in Hz to drive the simulation 
|}==Macro reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerBeep'''
|-
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OnTime
|-
| colspan="2" | Length of time in ms the buzzer will remain on 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OffTime
|-
| colspan="2" | Length of time in ms the buzzer will remain off 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumberLoops
|-
| colspan="2" | Number of times to repeat the sequence. Range 1-255 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


 
===BuzzerBeep===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOff'''
|-
| colspan="2" | Switch Off the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOn'''
|-
| colspan="2" | Switch On the Buzzer 
|-
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" class="mtx-class-macrohead" | '''BuzzerBeep'''
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOnDelay'''
|-
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Time
|-
| colspan="2" | Time in milliseconds to keep the buzzer on 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
 
 
==Property reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Output Pin
|-
| colspan="2" | Pin used to drive the output to the buzzer 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Polarity
|-
| colspan="2" | Controls the pin state required to switch the buzzer on. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Buzzer Frequency
|-
| colspan="2" | Frequency of the buzzer in Hz to drive the simulation 
|}==Macro reference==
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerBeep'''
|-
|-
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
Line 427: Line 136:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===BuzzerOff===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOff'''
| width="90%" class="mtx-class-macrohead" | '''BuzzerOff'''
|-
|-
| colspan="2" | Switch Off the Buzzer 
| colspan="2" | Switch Off the Buzzer 
Line 440: Line 150:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===BuzzerOn===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOn'''
| width="90%" class="mtx-class-macrohead" | '''BuzzerOn'''
|-
|-
| colspan="2" | Switch On the Buzzer 
| colspan="2" | Switch On the Buzzer 
Line 453: Line 164:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===BuzzerOnDelay===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOnDelay'''
| width="90%" class="mtx-class-macrohead" | '''BuzzerOnDelay'''
|-
|-
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
Line 469: Line 181:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
==Property reference==
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Output Pin
|-
| colspan="2" | Pin used to drive the output to the buzzer 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Polarity
|-
| colspan="2" | Controls the pin state required to switch the buzzer on. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Buzzer Frequency
|-
| colspan="2" | Frequency of the buzzer in Hz to drive the simulation 
|}==Macro reference==
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerBeep'''
|-
| colspan="2" | Switches the buzzer on and off automatically to allow for a series of beeps 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OnTime
|-
| colspan="2" | Length of time in ms the buzzer will remain on 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | OffTime
|-
| colspan="2" | Length of time in ms the buzzer will remain off 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumberLoops
|-
| colspan="2" | Number of times to repeat the sequence. Range 1-255 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOff'''
|-
| colspan="2" | Switch Off the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOn'''
|-
| colspan="2" | Switch On the Buzzer 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BuzzerOnDelay'''
|-
| colspan="2" | Switch the Buzzer on for a fixed amount of time 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Time
|-
| colspan="2" | Time in milliseconds to keep the buzzer on 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 593: Line 201:
| colspan="2" | Controls the pin state required to switch the buzzer on. 
| colspan="2" | Controls the pin state required to switch the buzzer on. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 1.0
Category Audio Output


Buzzer component

Drives a simple fixed frequency buzzer in hardware and simulates the sound of a buzzer in simulation. To actually drive a buzzer you would have to amplify the signal from the microcontroller using a transistor or MOSFET.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Buzzer.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Buzzer.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Depending on your Buzzer you may need to amplify the signal from the microcontroller using a NPN transistor or N channel FET.



A basic buzzer example using all the buzzer functions.

It should be noted that if you have a single BuzzerOn component with no loop, the buzzer sound will stop when the simulation stops.

The pin will remain high.

While the buzzer is on, the simulation tone is not continuous, it rapidly pulses, the pin will remain high.

That is not a bug with the component

Basic Buzzer Example






Macro reference

BuzzerBeep

BuzzerBeep
Switches the buzzer on and off automatically to allow for a series of beeps 
- UINT OnTime
Length of time in ms the buzzer will remain on 
- UINT OffTime
Length of time in ms the buzzer will remain off 
- BYTE NumberLoops
Number of times to repeat the sequence. Range 1-255 
- VOID Return


BuzzerOff

BuzzerOff
Switch Off the Buzzer 
- VOID Return


BuzzerOn

BuzzerOn
Switch On the Buzzer 
- VOID Return


BuzzerOnDelay

BuzzerOnDelay
Switch the Buzzer on for a fixed amount of time 
- UINT Time
Time in milliseconds to keep the buzzer on 
- VOID Return


Property reference

Properties
Output Pin
Pin used to drive the output to the buzzer 
Polarity
Controls the pin state required to switch the buzzer on. 
Simulation
Buzzer Frequency
Frequency of the buzzer in Hz to drive the simulation