Difference between revisions of "Component: PWM (Internal) (General Output)"
| Line 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
| − | | | + | | 12.0 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
| Line 15: | Line 15: | ||
Pulse Width Modulation, a versitile way of generating a digital pulse using mark / space modulation. Uses the capture compare peripherals onboard most Microcontrollers to generate accurate waveforms without any intervention from the processor. Useful for generating audio, controlling the speed of motors, brightness of LED etc. | Pulse Width Modulation, a versitile way of generating a digital pulse using mark / space modulation. Uses the capture compare peripherals onboard most Microcontrollers to generate accurate waveforms without any intervention from the processor. Useful for generating audio, controlling the speed of motors, brightness of LED etc. | ||
| − | == | + | ==Version information== |
| − | + | Library Version, Component Version, Date, Author, Info | |
| + | 11, 11.0, 15-10-24, BR, Fixed change frequency and duty for ESP32 | ||
| + | 12, 12.0, 15-10-24, MW, Fixed Digital version as visually looks wrong | ||
| + | |||
| − | |||
==Detailed description== | ==Detailed description== | ||
| Line 310: | Line 312: | ||
| colspan="2" | Edits how the PWM is shown on the simulation panel. | | colspan="2" | Edits how the PWM is shown on the simulation panel. | ||
|} | |} | ||
| + | |||
| + | ==Component Source Code== | ||
| + | |||
| + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_PWM_Output.fcfx FC_Comp_Source_PWM_Output.fcfx] | ||
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_PWM_Output.fcfx FC_Comp_Source_PWM_Output.fcfx] | ||
Latest revision as of 21:16, 27 January 2026
| Author | Matrix Ltd |
| Version | 12.0 |
| Category | General Output |
Contents
PWM (Internal) component
Pulse Width Modulation, a versitile way of generating a digital pulse using mark / space modulation. Uses the capture compare peripherals onboard most Microcontrollers to generate accurate waveforms without any intervention from the processor. Useful for generating audio, controlling the speed of motors, brightness of LED etc.
Version information
Library Version, Component Version, Date, Author, Info 11, 11.0, 15-10-24, BR, Fixed change frequency and duty for ESP32 12, 12.0, 15-10-24, MW, Fixed Digital version as visually looks wrong
Detailed description
No detailed description exists yet for this component
Examples
Here is a basic example to control the PWM duty based on an ADC reading.
Digital PWM trace
Here is another basic example which ramps the PWM duty cycle up and down. If the PWM output pin is connected to a LED and series resistor then the LED will smoothly transition between on bright and off.
Macro reference
ChangePeriod
Disable
| Disable | |
| Disables a PWM channel and allows the default output / input state to be resumed | |
| Return | |
Enable
| Enable | |
| Enables a PWM channel as an output overriding the default output pin state. | |
| Return | |
SetDutyCycle
SetDutyCycle10Bit
SetFrequency
| SetFrequency | |
| Sets a PWM of the specifed frequency at a duty of 50% Ideal use is a frequency generator | |
| Frequency | |
| Enter frequency in Hz | |
| Return | |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_PWM_Output.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_PWM_Output.fcfx
