mrrwa / NmraDcc

NMRA Digital Command Control (DCC) Library
GNU Lesser General Public License v2.1
135 stars 53 forks source link

ESP32 motor pwm #46

Closed alsacian closed 3 years ago

alsacian commented 3 years ago

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

kiwi64ajs commented 3 years ago

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?

alsacian commented 3 years ago

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

kiwi64ajs commented 3 years ago

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

kiwi64ajs commented 3 years ago

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

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