Это видео недоступно.
Сожалеем об этом.
Add a web control panel to your project - the web server
HTML-код
- Опубликовано: 17 авг 2024
- Adding a web based control panel to your Micropython project allows you much easier monitoring and control of your device. Just pull up a web browser and interact with your project on a fully graphical user interface.
This is part one of a three part series. We'll build the web server code so that you can connect to your device, get it to decode your request, action it and then send back any data or code files that you need.
The tutorial uses a Raspberry Pi Pico W but any Micropython, WiFi enabled device will work.
Check out the project page on my main website at
bytesnbits.co....
Download the code from my GitHub repository
github.com/get...
0:00 Introduction
2:24 How a web server handles requests
4:06 The HTTP request message
11:45 The RequestParser code
15:58 HTTP response message
19:40 The ResponseBuilder code
23:52 Decoding the request and actioning it
27:43 What's next
Very comprehensive.
Came across these a couple of months ago - definitely the best tutorials on the topic out there.
Only now getting the chance to try and put physically into practice.
Thank you for all the effort you put into this
Glad it was helpful!
Just came across this one late night coding. It's a lot more in depth and packed full of content than I thought, which is a welcome surprise by all means. Will be watching all the videos in order to better understand your flow, and how to get it working :)
Glad you enjoyed it!
Excellent set of tutorials on Pico Pi web apps, thanks !
Glad you like them!
this is such a good tutorial, it should really be way more popular, thank you
Glad you think so!
Micro python,wifi connection, pi pico W, socket, html, web page, request, Json..etc..Thank you
for making me, learn about all those interesting topics through the building process of this Web Control Interface.
I watched your 3 last video and appreciated your explanations on all of those. So far , I made everything
running on PI Pico and as well on an ESP32 (with some modifications for the WIFI connection).Regards.
Michel
Thanks for your comments. I hope you're finding the techniques useful.
A new vid after all this time. Very nice
Hi. Too much work. Too little time!
Thank you!
Your tutorials are very helpful. Can you please tell me what Editor/IDE you are using for these projects? I prefer VSCode, but have problems running my PICO-W projects from within that IDE. I installed the "PICO-W-GO" vscode extension, and several other extensions for code completion and live server. I also have tried Thonny, but it isn't nearly as elegant.
ANY suggestions would be much appreciated! Thank you
I use PyCharm. The community edition is free and gives you a very good IDE. There is a Micropython extension that gives you the REPL terminal etc. I did make a video on setting it up a while back. ruclips.net/video/44dwZCz4_sc/видео.html
@@BytesNBits Thank you for responding! I did watch the set up video that you referenced and it was most helpful. I found the older version of Pycharm on the JetBrains website and installed it on my 2011 iMac. I got it working with a Pico-W, running micro python with the plug in that it installed. However, the RePL is sometimes intermittent, and I find the PyCharm interface somewhat obtuse. So, after still struggling with VSCode, and the Pico-W-Go extension, I have that working pretty well. Unfortunately, the extension author keeps updating it, and the newer versions are buggy.
so, I'm back to Thonny 4.02 and after watching Chris DeHut's RUclips tutorial series on Thonny, I've (for now)
settled into using it. Thank you for your detailed tutorials and please keep them coming.
@@johncutler5995 No problem. VSCode is a great editor. I use the JetBrains apps for my main web development work so am used to it's interface - common across all it's apps. The REPL plugin needs the newest version of PyCharm to work reliably. It's actually a good implementation now. As always I guess these plugins etc will settle in after a while.
Any idea why in ResponseBuilder *path, filename = req_filename.rsplit("/", 1)* returns *['index.html']* instead of *['', 'index.html']* ?
if the filename doesn't contain a / you'll just get the full string returned as a single element array. It looks like that's what's happening. At the start of the function the code should add a / if it's missing. You'll need to add some checks to see why the / is not getting prepended to the string.
Got it now. I was passing empty string '' to the method instead of 'index.html'. Silly mistake 😆
Does this can be accessed remotely with other devices and wifi address?
When connected to your home router is will be hidden behind your router firewall (as it should). If you want to get remote access you'll have to open up a port to your device in the router settings, or place it in the DMZ zone to fully expose it. You'll then need to make sure you have a reliable way of connecting to your router's public IP address. If you haven't got a fixed IP you'll need to use one of the dynamic DNS services. It probably sounds more complicated than it is - probably a good topic for a video :)
thanks for this video - really appreciate it. I have some background programming - just not web stuff so I was looking for something I could use as an interface for a few projects that I'm building on pico-w for home automation. Would I be able to use this as something that picks up readings from sensors running in an infinite loop and storing data variables in a main loop and displaying the status on the webpage? The whole 2 threads only on the pico means being more careful in paying attention to what is going on than I normally would!
Yes. That's an ideal project for this code. Make sure you have a look at the last 2 videos in this series. I show you how to make better use of the cores and transfer a lot of the processing and display work down to the browser leaving the Pico as a data gathering and control tool.
@@BytesNBits - will do!
This tutorial is super. Once I realized that I needed to download and install the postman desktop agent, I was able to get it working to send GET requests to the Pico as shown in the video. However, your video doesn't show the details of the POST request so I wasn't able to get that working. Can you show the URL of the POST request?
In postman you need to create a POST request and then fill in one of the parameter blocks. The Pico uses the same URL to receive each request. I go into it all in a lot more detail in the next video. ruclips.net/video/PY732g2ZN4g/видео.html
Thanks for this tuto
You're welcome
will somebody please make a video on how to do such things in c/c++ PLEASE?
More C++ tutorials are on my list. Just finding time to get the projects completed at the moment. Keep an eye out.
Would have been nice if this was done with C/C++. I have absolutely no use or love for "Python"! To me Python is like a car that has an 8 cylinder engine, but only runs on three, stuck in second gear, with the rear tires being flat! Otherwise your tutorial would have been great. SORRY! At 11:12, I ended it and went elsewhere.
No problem. I use Python to help novice coders.
Really cool tutorial. May I know what software you use to display those diagrams? The one in this section ruclips.net/video/h18LMskRNMA/видео.html They are really helpful for visualizing the subject.