Jump to content

Component: Piezo Sounder (Audio Output): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(9 intermediate revisions by 2 users not shown)
Line 17: Line 17:
==Component Source Code==
==Component Source Code==


Please click here to download the component source project: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_PiezoSounder.fcfx FC_Comp_Source_PiezoSounder.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_PiezoSounder.fcfx FC_Comp_Source_PiezoSounder.fcfx]


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_PiezoSounder.fcfx FC_Comp_Source_PiezoSounder.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_PiezoSounder.fcfx FC_Comp_Source_PiezoSounder.fcfx]


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




Line 46: Line 50:


==Examples==
==Examples==




Line 74: Line 82:


[[File:BuzzerWire.jpg]]
[[File:BuzzerWire.jpg]]
==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" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Frequency
|-
| colspan="2" | frequency in hz to output to the Piezo sounder 
|-
| 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" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Frequency
|-
| colspan="2" | Frequency to output in Hz 
|-
| 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 
|}==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" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Frequency
|-
| colspan="2" | frequency in hz to output to the Piezo sounder 
|-
| 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" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Frequency
|-
| colspan="2" | Frequency to output in Hz 
|-
| 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 
|}==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===BuzzerBeep===
{| 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;" | '''BuzzerBeep'''
| width="90%" class="mtx-class-macrohead" | '''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 254: Line 129:




{| 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 275: Line 151:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| 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'''  
|-
|-
|-
|-

Latest revision as of 14:23, 13 July 2026

Author Matrix TSL
Version 1.0
Category Audio Output


Piezo Sounder component

Drives a simple variable frequency piezo sounder in hardware and simulates the sound in simulation. To actually drive a piezo you may 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_PiezoSounder.fcfx

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

Detailed description

No detailed description exists yet for this component

Examples

Here is a simple example that will create a siren effect using a piezo sounder. Piezo Siren Depending on your Piezo Sounder you may need to amplify the signal from the microcontroller using a NPN transistor or N channel FET.







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 
- UINT Frequency
frequency in hz to output to the Piezo sounder 
- VOID Return


BuzzerOnDelay

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


Property reference

Properties
Output Pin
Pin used to drive the output to the buzzer