Conversation

pkoscik

This example does not work correctly RPI Pico W. Accessing the light/on and light/off endpoints does not toggle the LED state.

This fixes the issue.

@pkoscikpkoscik changed the title wireless: Change Pin 15 to Pin LED webserver.py: Change Pin 15 to Pin LED May 12, 2023
@lurch

See section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf - I believe this PR is redundant?

@bwenrich

Confirming that the existing sample code does not toggle the LED in my environment (Pico W with MicroPython v1.22.1). Manually managing a different pin number for Pico and Pico W is not complex, but is annoying. ex: https://forums.raspberrypi.com/viewtopic.php?t=336836 In recent versions of MicroPython this should no longer be necessary.

If I am reading correctly, MicroPython 1.20 introduces support for the Pin("LED", Pin.OUT) syntax via the "named pins" feature, which is also the first time they are providing a Pico W-specific build. Considering that this example is most relevant for the Pico W's network hardware, maintaining compatibility with older releases for the Pico may not be too concerning.

My opinion is that this PR would be helpful for two reasons:

  • Improves the user experience. New users who try these samples on the current version of MicroPython will get a functioning example
  • Consistency with other examples in this repo. This syntax is already used in other examples such as the basic blink.py
    led = Pin("LED", Pin.OUT)

@dpgeorge

See section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf

This example in the datasheet there suggests that an external LED is connected to GPIO 15, and so the code is written assuming such a wiring. I guess that's done to teach how to wire up parts, rather than relying on the built-in LED.

If I am reading correctly, MicroPython 1.20 introduces support for the Pin("LED", Pin.OUT) syntax via the "named pins" feature,

Yes that is correct. It's now possible to access the built-in LED on both the Pico and Pico W using Pin("LED"). So the example code could be changed to use the built-in LED, but then any external LED that's wired to GPIO 15 wouldn't work.

@aallanaallan merged commit 956d008 into raspberrypi:master Jan 22, 2024
@aallan

Reverted #71.

See the description of this example in Section 3.9.2 of https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf. This was never supposed to work with the onboard LED so shouldn't be using the LED pragma.

@aallanaallan added the wontfixThis will not be worked onlabel Jan 22, 2024
@pkoscikpkoscik deleted the wireless_fix_pin branch January 24, 2024 16:17
@lurchlurch mentioned this pull request Mar 18, 2025
Sign up for free to join this conversation on . Already have an account? Sign in to comment
wontfixThis will not be worked on
None yet

Successfully merging this pull request may close these issues.