Skip to content
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

Fix #70 #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix #70 #84

wants to merge 2 commits into from

Conversation

lurch
Copy link
Contributor

@lurch lurch commented Mar 17, 2025

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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@lurch lurch requested a review from peterharperuk March 17, 2025 16:10
@dpgeorge
Copy link

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
Copy link
Contributor Author

lurch commented Mar 18, 2025

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 😉

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add links to the rendered webpage to make it easier to urn the LED on and off
@dpgeorge
Copy link

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.

Copy link

@dpgeorge dpgeorge left a comment

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
Copy link
Contributor Author

lurch commented Mar 19, 2025

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 GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants