-
Notifications
You must be signed in to change notification settings - Fork 26
Add LED Fade Example #105
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
base: master
Are you sure you want to change the base?
Add LED Fade Example #105
Conversation
An example that uses ULP self-modifying code to create a PWM-like LED dimming effect on GPIO 15.
Very cool contribution! I like the self-modification to work around WAIT's fixed operand limitation. Did you run this on an S2 or S3 (given that we're using the |
Thanks, I have only tested this on an S2 (see here for the board I used) , as this is all I have access to right now. |
Example code for reading the temperature of the chip using the ULP of the ESP32-S2
Just tested this on my S2 and it worked a charm. Except for one small niggly... related to my board: the LED was already on with a faint glow, before I started the program. The reason turns out, that on my board (Waveshare ESP32-S2 Pico), GPIO15 is used for I2C and pin 15 is pulled high with an external resistor. So current leaks via that resistor and my LED. Looking at the schematic of your board, GPIO15 is not connected to anything else, so in your case GPIO15 will work fine. Was there a reason you picked GPIO15? I have generally used GPIO4 for my projects, which does not usually seem to be used for anything else. I googled for a few dev boards, and none used GPIO4 for anything. And the ESP32-S2 Technical Reference Manual also shows that GPIO4 has no other functions mapped to it. I have also often used GPIO2, but on one of my boards it was connected to the onboard LED (but in active-low mode). Perhaps it's useful to change the example to use GPIO4? That way is should not (as far as I can see) interfere with other things. Also the code might read more easily, because the current constants refer to XTAL32 (because of what Espressif named it) and it might not be obvious to readers that this refers to GPIO15. GPIO4 instead is named TOUCH_PAD4, which is still somewhat confusing, but a bit more obvious in that it refers to GPIO4. I don't mind that much keeping the example at GPIO15, but if you had no specific reason (or wish) to have it on GPIO15, then I'd suggest changing it. i.e. |
Btw, the temperature sensing example also works as advertised. Very nice. We can merge it as is. |
made the default LED pin 4, with the option for the user to change led_pin.
@wnienhaus The example now makes no reference to any particular dev board, and is set to pin 4 by default. The user only has to change led_pin (is this obvious, or should this be made more clear?). |
An example that uses ULP self-modifying code to create a PWM-like LED dimming effect on GPIO 15.