Got the PWM working in Lorlin32 Lite at my target Fq. of 1Hz.
The thing is any PWM Set Duty Cycle macro I use appears to get over-ridden by the low level settings in the component PWM. In the current code I get a duty-cycle of 50% which I can live with but would have preferred to have custom control over the duty cycle e.g. 20/80 mark / space. Is there an easy way of doing this and still retain my 1Hz PWM Fq? TIA.
Is it possible to customise the duty cycle setting in this demo?
-
- Posts: 108
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 3:54 pm
- Has thanked: 6 times
- Been thanked: 12 times
Is it possible to customise the duty cycle setting in this demo?
- Attachments
-
- Potentiometer_ESP.fcfx
- (17.97 KiB) Downloaded 6 times
-
- Matrix Staff
- Posts: 1988
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 630 times
- Been thanked: 660 times
Re: Is it possible to customise the duty cycle setting in this demo?
Hello.
I have modified your project so PWM duty ranges from 0 to 100% when POT ranges 0 - 4095
The PWM duty is only set when the pot changes value.
If pot value is too unstable on ESP32, use the GetAverageInt function instead
I have modified your project so PWM duty ranges from 0 to 100% when POT ranges 0 - 4095
The PWM duty is only set when the pot changes value.
If pot value is too unstable on ESP32, use the GetAverageInt function instead
- Attachments
-
- Potentiometer_ESP v2.fcfx
- (19.6 KiB) Downloaded 8 times
Martin
-
- Posts: 108
- Joined: Thu Dec 10, 2020 3:54 pm
- Has thanked: 6 times
- Been thanked: 12 times
Re: Is it possible to customise the duty cycle setting in this demo?
Thanks Martin. That is a very elegant bit of code. Thanks also for introducing me to the maths map component. I have managed to pull out snippets of your demo and get the PWM duty cycle function working now. 
