Jump to content

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

From Flowcode Help
Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix TSL |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gray..."
 
No edit summary
Line 16: Line 16:


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


''No detailed description exists yet for this component''
''No detailed description exists yet for this component''


==Examples==
==Examples==





Revision as of 21:08, 16 November 2021

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. 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.


Downloadable macro reference

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
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


SetAddress
Allows a different I2C address to be specified allowing one component to control multiple PCA9685 modules. 
- BYTE Address
Range: 0x40 - 0x7F 
- VOID Return


SetClockFrequency
Sets the current clock frequency, used for things like calculating the PWM frequency and Microsecond duty. 
- ULONG Clock
 
- VOID Return


GetClockFrequency
Returns the current clock frequency 
- ULONG Return


WriteMicroseconds
Sets the PWM output of one of the PCA9685 pins based on the input microseconds, output is not precise 
- BYTE Output
One of the PWM output pins - Range: 0 to 15 
- UINT Microseconds
The number of Microseconds to turn the PWM output ON 
- VOID Return


SetPWM
Sets the PWM output of one of the PCA9685 pins 
- BYTE Output
One of the PWM output pins - Range: 0 to 15 
- UINT On
At what point in the 4096-part cycle to turn the PWM output ON 
- UINT Off
At what point in the 4096-part cycle to turn the PWM output OFF 
- VOID Return


Initialise
Sets up the I2C ready for communications to begin 
- VOID Return


WakeUp
Wakes the module from Sleep mode 
- VOID Return


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. 
- BYTE Output
One of the PWM output pins - Range: 0 to 15 
- UINT Duty
The number of ticks out of 4096 to be active 
[[File:]] - Invert
0=Normal, 1=Inverted 
- VOID Return


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


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 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


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


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


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. 
- VOID Return


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 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


Initialise
Sets up the data memory and draws the simulated LED cube on the panel. 
- VOID Return



Property reference

Properties
Output Pin
Pin used to drive the output to the buzzer 
Color
Controls the color of the Buzzer object on the panel. 
Connections
Simulations