Conversation

lurch

Untested, but in #70 (comment) @dpgeorge says that this should work 😉

@lurchlurch requested a review from peterharperuk March 17, 2025 16:10
@dpgeorge

I tested this on a Pico W and it works well.

Might I also suggest the following changes, to make it more user friendly:

  • change the led init line to led = Pin("LED"), so it actually turns the built-in LED on and off
  • add these two lines to the HTML that it sends (after the <p>%s</p>):
        <button onclick="window.location='/light/off'">Turn off</button>
        <button onclick="window.location='/light/on'">Turn on</button>

That gives you buttons to turn on/off via navigation to the correct page.

@lurch

I tested this on a Pico W and it works well.

Thank you! 👍

Might I also suggest the following changes, to make it more user friendly:

  • change the led init line to led = Pin("LED"), so it actually turns the built-in LED on and off

See #66 and #71

  • add these two lines to the HTML that it sends (after the <p>%s</p>):
        <button onclick="window.location='/light/off'">Turn off</button>
        <button onclick="window.location='/light/on'">Turn on</button>

That gives you buttons to turn on/off via navigation to the correct page.

Surely it's easier to just use a href links, rather than relying on buttons with javascript onclick handlers?
EDIT: Which I've just done 😉

Add links to the rendered webpage to make it easier to urn the LED on and off
@dpgeorge

Might I also suggest the following changes, to make it more user friendly:

  • change the led init line to led = Pin("LED"), so it actually turns the built-in LED on and off

See #66 and #71

Ah, right, thanks for reminding me!

Surely it's easier to just use a href links, rather than relying on buttons with javascript onclick handlers?

Yes, simpler to use a href. It's just that buttons look better 😄 although you could use CSS for the hrefs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a Pico W with Firefox. It works.

@lurch

although you could use CSS for the hrefs.

Our examples are deliberately kept simple and bare-bones. They're intended to demonstrate the functionality of the underlying code, not HTML styling 😉

Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.