FLEXIBLE Data Input: Transmit any value from HTML to pi pico in MicroPyhton
Вставка
- Опубліковано 26 сер 2024
- In this video i explain how to transmitt adjustable values from a Website running on a @raspberrypi Pico W to the micorpyhton programm part. For the tranmission i use AJAX. In the example i use a timer to make adjustable delay. This could also used by other Board with a RP2040 and WiFI.
--------------------------------------------------------------------------
Github resporitory for inital programm code:
github.com/Lut...
Video how to setup a Pi Pico W:
• Step-by-Step Pi Pico W...
----------------------------------------------
Buy Raspberry Pi W and support my channel without extra costs :
US
Pi Pico W:
amzn.to/3WJIrES*
Pi Pico with full starter KIT:
amzn.to/3XWZkga*
Germany:
Pi Pico W:
amzn.to/3JowFfY*
Pi Pico with full starter KIT:
amzn.to/3Dfpnr9*
*affiliate link
hanks lot Sir.. You helping us..
Thanks so much for the clear explanation, was making a small digital to-do list that was updated from a web form hosted on the pico so this tutorial was exactly what I needed to take the input from the web form and add it to the todo list! Thanks!
Hei Man Great Job. You were exactly what I was looking for, your explanations were right on the point. I will love to see how you implement a range slider and maybe also a list in the page to see all the value that the slider takes.
You are doing a great job there! thanks for the video 👍🏼
This was so helpful!! Thank you
Since you asked I would love to see how you code a range slider to adjust the brightness of an LED. Of course multiple sliders would be better. Thanks. Just found your channel and you got my sub.
Thanks for your command, i will Check when there is time for it 😀
Don't be so hard on yourself. I think it's lovely, Lutz. 3:20. I would still like to see how you would make it even more lovely.
Thanks for your command, sorry for my late response, i was a Bit busy Last time :-) i will Check when i have time for it.
You are the best!
I hope this is what you need. If so, pleased inform your Friends about my Channel 😉
@@lutz4tech when I go to look at the printed request after entering a value and clicking toggle I'm not finding that value in the bGET
Yes, i remeber that issu as i prepared the Video. You get a Message but the value ist not in? In May Case there was a Typo in the HTML Part, it was a hard Fight to find it.
I will Upload my Code to GitHub in the next days may that helps to find your issu.
@@lutz4tech any luck with uploading the code?
Hi Tom, weekend is family time ;)
I upload right now, so here we go:
github.com/LutzEmbeddedTec/Pico_w_adjustable_values
let me know if this codes work on your Pico W
Thank you for this demo, and your others too! I've been struggling with doing the reverse of what you show here, updating just part of the website instead of a full refresh using AJAX.
My use case: Pico W setup as an AP, connect and open a webpage where it lists nearby networks with a refresh button that only updates the network list, not the entire page. Select a network & enter a password. Pico W then connects to that network. This would be for initial setup for a IoT device. I have the basic functionality working, its just not polished feeling when the full page needs to be refreshed to update the network list.
At First thanks for your Feedback im Always Happy If i can Help Somebody.
Yes i Unserstand your Problem. The Challenge is that you need to create Data in Python side with the WiFi you want to Connect to, but the Data is Not available Düring the Website ist "build"
Im Not Sure but may you can use a Ajax with a ASP File, Like the example here:
www.w3schools.com/js/js_ajax_asp.asp
I Hope this helps, im Not an expert for this topic ;)
Hallo Lutz, bei mir funktioniert der Befehl “period=int(split2_request[3]” nicht. Micro Python beschwert sich, dass das Argument “3” out of range ist und es einen Text nicht in integer umwandeln kann. Welchen Wert solte die period haben? Ich habe deinen Code 1:1 kopiert. Ich benutze Thonny. Danke
Can you use this same method for pulling data from any website and turn it into an int for a variable in micropython? I think this would be handy for making a rtc code that refers to a online rtc for its time. Figured it out! I'll share the code once I get it uploaded. A rtc reference for the Pico w will be a game changer!
I would use a "urequests" to do it. Now i´m curious about your solution :-)
@@lutz4tech I'm using it to get a refer to my accurate timezone and update its internal clock time.localtime every 30mins before it refers to time.localtime for a function. Apparently the RP2040 interval clock can drift up to an hour in a year and also the Pico knows exactly what time to set when powered on after being off.
It is possible to make the inverse? Trasmit a variable from Microphyton to HTML?
Yes. i Showed this in the First Video about the Pico w here: ua-cam.com/video/fqsOZ_FVgfg/v-deo.html
If you don't find what you need let me know.
@@lutz4tech Hi, What I intend to do is, with a click of a button in the browser, display a text file that contains sensor data.
@@Yurpt should Work in the Same way, as i used the Update Button In the First Code. Here You can put the values in you want to Show the User.
@@lutz4tech Yes, but the data file (report.txt) is in the root of the pico w.
Would be interesting to see how to run a completely restful api with json response to specific verbs like get, post ect
Nice Idea, i will Put it on the to do list and see If i have time for it. Thank you
@Lutz cheers brother. I'll have a go too and share what I find. Not sure if 3rd party library's are the best approach but I like simple :)
hey thanks this was really helpful, I came across this vid in my search to know how to set a light cycle timer that repeats every 24 hours that is set at a specific time during the day. For example on the web page you would enter/select 7am as a start for the light cycle then pick a light cycle like 12 hours, that then would turn the LED on at 7am go on for 12 hours then turn off the led, and repeat until a different light cycle or time of start is selected. any clue on how I could get started with that?
Hi, thanks for your command. I would use a rtc (ua-cam.com/video/fItvY5JIvo8/v-deo.html) on the Pico. That give you a Clock. In the Video i explain how to run a command at i defined time. This should bei Close to what you need?
Use Phew.
Hello, i'm new to all of this and have no idea of how to do the same with sliders, can you help me?
Edit: figured it out, thanks!
Perfect! What Kind of Project your working on?
@@lutz4tech its a led strip i want to control from my bed 😂
@@lemur8111 OK this should be good to adapt on functional side. Just Change the Timer to a periodic one, or use a Software pwm. You propably already firgured Out how this works.
May you need to think about the Error Handling (WiFi interruption or Else) here i would recommend to use a watchdog ( ua-cam.com/video/2spOnBfxEjo/v-deo.html )
@@lutz4tech i didn’t think about wifi interruption, i’ll look into it, thanks!
@@lemur8111 hehe, i also didn't think about this point as i recorded this Video. One of my subsrcibers raised this point in the commands. He also tested His solution.
Good luck and have fun with your Project.