-
Notifications
You must be signed in to change notification settings - Fork 17
ESP32 PWM Support (for Servo, Sound) #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have more than 8 hours trying to run a Servomotor in esp32 and I could not. Configure everything but nothing happens |
You mean in the Simulator? Or on a physical ESP32 chip? |
I mean the simulator I am setting up the example library and it doesn't work
I have placed the reference as advertised by the guide in a txt called libreries.txt
the diagram.json
|
Thanks for the details! It won't work until this feature (PWM on ESP32) is implemented. It's open for voting but doesn't have any votes at the moment. When it get some votes we can start looking into implementing it. |
Also required for sound. |
@jflamy the documentation for the ESP32 shows that PWM is not yet implemented. I think it makes more sense to document the limitations of each MCU's simulation on the page for that MCU, rather than spray it across every other component's docs. Would you agree? |
Note: I started looking into this, and there are two kinds of PWM peripherals for the ESP32:
As far as I can tell, the Servo library uses the LED_PWM. It's also likely that tone generation uses LED_PWM. |
Update: Servo now works! https://wokwi.com/arduino/projects/323706614646309460 I haven't tested the sound yet, so I'm keeping this issue open until we can confirm that sound also works |
Project https://wokwi.com/arduino/projects/323708751863349844 is a hacked down version with a Tone library sound that works in real life. The bottom buzzer should sound 3 times with a one second interval. The first iteration shows notes, but no sound. In real life, this code works (i.e. the first iteration does work right away -- the first 30 seconds of this video show this feature in real life. The second and third iteration do provide sound. Note that there are notes shown next to the buzzer during setup, as if the pins were turned on for a tiny bit. |
Thanks for testing, @jflamy! Interestingly, when looking at the logic analyzer trace, I can see the PWM signal going out three times: So there's probably some issue with the buzzer simulation itself. My bet is that Web Audio isn't ready yet when the first note starts playing, so Wokwi silently skips that note. |
Might be the same issue as #241 |
Adding a fake "turn sound on/turn sound off" for a very short period in the setup stage kludges around the issue for the simulator. |
Closing this issue as PWM seems to be working properly from the PWM side. I also did a bunch of fixes to the buzzer algorithm, but if the problem persists, feel free to open a separate issue. |
PWM is required for the ESP32Servo library
The text was updated successfully, but these errors were encountered: