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: 113
- 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 104 times
-
- Matrix Staff
- Posts: 2076
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 638 times
- Been thanked: 697 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 121 times
Martin
-
- Posts: 113
- 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. 

-
- Valued Contributor
- Posts: 1677
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 373 times
- Been thanked: 581 times
Re: Is it possible to customise the duty cycle setting in this demo?
Hi
Has anything happened with the ESP Lolin-Lite or PWM?
Not geting anything on a scope when I use components / properties in above post by Martin, but it does simulate.
Regards
Has anything happened with the ESP Lolin-Lite or PWM?
Not geting anything on a scope when I use components / properties in above post by Martin, but it does simulate.
Regards
-
- Matrix Staff
- Posts: 2076
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 638 times
- Been thanked: 697 times
Re: Is it possible to customise the duty cycle setting in this demo?
Hi Iain .
Sorry for the delay.
I have just tested Lolin lite and PWM output is working as expected.
Attached is the project I had used.
I have included it as I have changed pins since the file attached above .
Sorry for the delay.
I have just tested Lolin lite and PWM output is working as expected.
Attached is the project I had used.
I have included it as I have changed pins since the file attached above .
- Attachments
-
- Potentiometer_ESP v2.fcfx
- (18.38 KiB) Downloaded 28 times
Martin
-
- Valued Contributor
- Posts: 1677
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 373 times
- Been thanked: 581 times
Re: Is it possible to customise the duty cycle setting in this demo?
Hi Martin
Thanks.
My chart was based on the previous example and was only to enable the PWM, no need to vary Duty. I just wanted an output. It used same pins but I couldn't get anything on scope.
I'll try again based on your reply above and let you know how I get on.
Regards
Thanks.
My chart was based on the previous example and was only to enable the PWM, no need to vary Duty. I just wanted an output. It used same pins but I couldn't get anything on scope.
I'll try again based on your reply above and let you know how I get on.
Regards