ESP32 PWM!

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jgu1
Posts: 615
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Flowcode v10 ESP32 PWM!

Post by jgu1 »

HI all!

I need to control a PWM via potentiameter in anothe project. First I test it in a simple testprogram. When I simulate the program it doesn´t work, I don´t see the PWM on the Graph. I have not test in real word yet, so I don´t know if it work,

What am I do wrong, please?

Br Jorgen
Attachments
PWM_ESP.fcfx
(11.34 KiB) Downloaded 8 times

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: ESP32 PWM!

Post by chipfryer27 »

Hi Jorgen

The PWM component needs to have a PWM Timer selected and has a period overflow of 255 for 8-bit devices and 65535 for 16-bit devices which also needs to be set according to your device.

I see your slider has a range of 0-4095 so you could perhaps use the Map component to scale to 0-255 for your Duty?

Hope this helps.

Regards

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: ESP32 PWM!

Post by jgu1 »

Hi chipfryer27

Many thank´s for your help. Yes I managed to get it work in simulation after your advice. I have compile to chip, no uotput

I use theanalog (warm ) Analog 4 = pin 32 and for the PWM out I use CH4 with pin B3 = D11

Do you have any advice? ;)
Attachments
PWM_ESP.fcfx
(11.53 KiB) Downloaded 12 times

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: ESP32 PWM!

Post by chipfryer27 »

Hi Jorgen

I don't use the ESP32 that much but from what I see with View > Target (showing pins)

I agree that the Slider is connected to IO32 / ADC4 PortB.0 but I'm unsure where you get D11 for the PWM. Is that a typing error?

How are you measuring the output? You will need a scope or an analyser on the pin to see the duty change.

Regards

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: ESP32 PWM!

Post by jgu1 »

Hi again!

I disvoverd that if I change the channel I saw that Pin was changing Timer A and B so I try to use Channel 1 and pin A15 then I get fine PWM out :)

I not managed it by any of the BPins. But anyway, by help from you I can continue my project. ;)

I think it is tricky with pinnumbers with ESP32, no logig :lol:

Again thank´s

Br Jorgen
Attachments
PWM_ESP.fcfx
(11.53 KiB) Downloaded 9 times

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 286 times
Been thanked: 412 times

Re: ESP32 PWM!

Post by chipfryer27 »

Hi
I think it is tricky with pinnumbers with ESP32, no logig :lol:
It certainly seems that way :)

Glad you have it working now.

Regards

Post Reply