-
Notifications
You must be signed in to change notification settings - Fork 237
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
Unable to simply toggle an LED on pico #1129
Comments
You are calling moddable/modules/io/digital/pico/digitalbank.c Lines 319 to 325 in 2420f19
The ESP32 implementation has an identical check. Are you certain this exact code worked as-is on ESP32? |
According to my git commits I was using this on NodeMCU and Moddable One about two years ago. I'll try to dig out my Moddable One board and test it properly - as I should've done before opening this issue, to be honest. |
OK @phoddie so I have double checked now and this exact code works as I expected on ESP8266 (NodeMCU). Also, does reading a digital PIN have some side effects? Read-only mode is obvious, but write-only not necessarily (to somebody who knows nothing about electronics that is). |
Thanks for the additional details. In the original report you wrote "ESP platforms." I interpreted that as ESP32, but actually it was ambiguous. ;) ESP8266 does not perform the check, so that explains why you didn't get an exception. Interesting that read returns a useful value for you there. Still, I'm sure that's not a reliable behavior across devices. Embarrassingly, I left myself a note to add the error check in the ESP8266 implementation: moddable/modules/io/digital/esp/digitalbank.c Lines 437 to 440 in 2420f19
I'll fill that in now so there is a consistent behavior across silicon architectures. Thank you for the report! |
Could you please clarify one thing for me. I was not sure about the meaning of "unimplemented", but now when you have changed the message, am I right assuming that it will not be implemented at all? Is it something unique to the IO module? Or a bad idea in general - the traditional |
Yup... I also find the pin implementation in io.Digital too restrictive, see EcmaTC53/spec#35 |
I've noticed that simple LED toggle is not possible on pico when using the IO module with this pattern:
led.write(!led.read())
Code example
More info
Example code fails due to these checks:
Is it intentional? I'm a bit surprised as it used to work well on ESP platforms the last time I was playing with Moddable.
The text was updated successfully, but these errors were encountered: