Component: Piezo Sounder (Audio Output)

From Flowcode Help
Revision as of 21:08, 16 November 2021 by Wiki bot (talk | contribs)
Jump to navigationJump to search
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.

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. FC6 Icon.png 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.


BuzzerWire.jpg

Downloadable macro reference

Fc9-comp-macro.png BuzzerBeep
Switches the buzzer on and off automatically to allow for a series of beeps 
Fc9-u16-icon.png - UINT OnTime
Length of time in ms the buzzer will remain on 
Fc9-u16-icon.png - UINT OffTime
Length of time in ms the buzzer will remain off 
Fc9-u8-icon.png - BYTE NumberLoops
Number of times to repeat the sequence. Range 1-255 
Fc9-u16-icon.png - UINT Frequency
frequency in hz to output to the Piezo sounder 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png BuzzerOnDelay
Switch the Buzzer on for a fixed amount of time 
Fc9-u16-icon.png - UINT Time
Time in milliseconds to keep the buzzer on 
Fc9-u16-icon.png - UINT Frequency
Frequency to output in Hz 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetAddress
Allows a different I2C address to be specified allowing one component to control multiple PCA9685 modules. 
Fc9-u8-icon.png - BYTE Address
Range: 0x40 - 0x7F 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetClockFrequency
Sets the current clock frequency, used for things like calculating the PWM frequency and Microsecond duty. 
Fc9-u32-icon.png - ULONG Clock
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetClockFrequency
Returns the current clock frequency 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png WriteMicroseconds
Sets the PWM output of one of the PCA9685 pins based on the input microseconds, output is not precise 
Fc9-u8-icon.png - BYTE Output
One of the PWM output pins - Range: 0 to 15 
Fc9-u16-icon.png - UINT Microseconds
The number of Microseconds to turn the PWM output ON 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetPWM
Sets the PWM output of one of the PCA9685 pins 
Fc9-u8-icon.png - BYTE Output
One of the PWM output pins - Range: 0 to 15 
Fc9-u16-icon.png - UINT On
At what point in the 4096-part cycle to turn the PWM output ON 
Fc9-u16-icon.png - UINT Off
At what point in the 4096-part cycle to turn the PWM output OFF 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Sets up the I2C ready for communications to begin 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png WakeUp
Wakes the module from Sleep mode 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetPin
Sets pin without having to deal with on/off tick placement and properly handles a zero value as completely off and 4095 as completely on. 
Fc9-u8-icon.png - BYTE Output
One of the PWM output pins - Range: 0 to 15 
Fc9-u16-icon.png - UINT Duty
The number of ticks out of 4096 to be active 
[[File:]] - Invert
0=Normal, 1=Inverted 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DrawRectangle2D
Draws a basic 2D rectangle onto the LEDs 
Fc9-u8-icon.png - BYTE X1
 
Fc9-u8-icon.png - BYTE Y1
 
Fc9-u8-icon.png - BYTE X2
 
Fc9-u8-icon.png - BYTE Y2
 
Fc9-u8-icon.png - BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
Fc9-u8-icon.png - BYTE R
 
Fc9-u8-icon.png - BYTE G
 
Fc9-u8-icon.png - BYTE B
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ShiftLEDs2D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
[[File:]] - X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
[[File:]] - Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
Fc9-u8-icon.png - BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetLEDIndex3D
Gets the index of a single LED in RAM as a 3D array. 
Fc9-u16-icon.png - UINT X
LED Column to change the colour / Range: 0 to (LED Column - 1) 
Fc9-u16-icon.png - UINT Y
LED Row to change the colour / Range: 0 to (LED Row - 1) 
Fc9-u16-icon.png - UINT Z
LED Layer to change the colour / Range: 0 to (LED Layer - 1) 
Fc9-u16-icon.png - UINT Return


Fc9-comp-macro.png DrawCuboid3D
Draws a basic 3D cuboid onto the LEDs 
Fc9-u8-icon.png - BYTE X1
Start X pixel coordinate 
Fc9-u8-icon.png - BYTE Y1
Start Y pixel coordinate 
Fc9-u8-icon.png - BYTE Z1
Start Z pixel coordinate 
Fc9-u8-icon.png - BYTE X2
End X pixel coordinate 
Fc9-u8-icon.png - BYTE Y2
End Y pixel coordinate 
Fc9-u8-icon.png - BYTE Z2
End Z pixel coordinate 
Fc9-u8-icon.png - BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
Fc9-u8-icon.png - BYTE R
Red Colour Channel 
Fc9-u8-icon.png - BYTE G
Green Colour Channel 
Fc9-u8-icon.png - BYTE B
White Colour Channel 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the LED ICs in the chain. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ShiftLEDs3D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
[[File:]] - X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
[[File:]] - Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
[[File:]] - Z
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
Fc9-u8-icon.png - BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Sets up the data memory and draws the simulated LED cube on the panel. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-5-icon.png Output Pin
Pin used to drive the output to the buzzer 
Fc9-type-1-icon.png Color
Controls the color of the Buzzer object on the panel. 
Fc9-conn-icon.png Connections
Fc9-conn-icon.png Simulations