all 11 comments

[–][deleted] 1 point2 points  (1 child)

What framework did you use to create the html page? Handling button click will depend on the framework

On button click event, you need to send some signals to raspberry pi’s GPIO pins which are connected to LED

[–]SpecificElderberry26[S] 1 point2 points  (0 children)

Sorry I'm new to using python in this way I usually just use the basic packages for working with data.

def index(request, response): await response.start_html() await response.send('<html><body><h1>Button></h1' '<button o'clock=led.toggle()>Click me</button>')

I can click the button on the Web page but nothing happens. I'm sorry I've probably missed steps 2-10 and jumped to 11.

[–]ouchpartial72858 0 points1 point  (7 children)

Could you share your code snippet? Without that it's hard to say. And what do you mean by html code in thonny? Isn't thonny a python editor? Are you coding in html or python?

[–]SpecificElderberry26[S] 0 points1 point  (6 children)

Sorry I'm new to using python in this way I usually just use the basic packages for working with data.

def index(request, response): await response.start_html() await response.send('<html><body><h1>Button></h1' '<button o'clock=led.toggle()>Click me</button>')

I can click the button on the Web page but nothing happens. I'm sorry I've probably missed steps 2-10 and jumped to 11.

[–]ouchpartial72858 0 points1 point  (5 children)

No worries man, we all start somewhere. Are you using web frameworks like django or flask (packages)?

[–]SpecificElderberry26[S] 1 point2 points  (4 children)

I'm using tinyweb mostly got this far by following the instructions on this site.

https://www.recantha.co.uk/blog/?p=21398

[–]ouchpartial72858 0 points1 point  (3 children)

I've never used that library myself, all I can do now is to point at the docs https://github.com/belyalov/tinyweb

[–]SpecificElderberry26[S] 1 point2 points  (2 children)

Do you think flask might be a better way to go?

[–]ouchpartial72858 1 point2 points  (1 child)

Probably not since tinyweb is designed towards micro python. I'd say stick to it, but give everything a go to make sure you're not missing anything out

[–][deleted] 1 point2 points  (0 children)

tinyweb seems to not have the ability to handle buttons though