mrrwa/NmraDcc

ESP32 motor pwm

Closed this issue · 4 comments

Hello,
Is it possible to have a multifuctionmotordecoder example working with ESP32
thanks

Does it not work for you or do you want it to do something special?

Can you provide some more details about the ESP32 and/or any interface hardware you'd like to use?

analogWrite(MOTOR_PWM_PIN, newPwm)
Doesn't work for ESP32

Googling this I find the ESP32 apparently doesn't support the analogWrite() function like the AVRs do.
However there is an alternative using the LEDC peripheral. See this post for more information:
https://randomnerdtutorials.com/esp32-pwm-arduino-ide/
HTH

Alex

This library: https://github.com/ERROPiX/ESP32_AnalogWrite

looks to also provide a nicely wrapped substitute for the missing native analogWrite() which should help