Raspberry Pi Pico W Simple Web Server C Tutorial - HTTP Server with SSI & CGI

  Рет қаралды 29,393

Learn Embedded Systems

Learn Embedded Systems

Күн бұрын

Пікірлер: 44
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/LearnEmbeddedSystems/. The first 200 of you will get 20% off Brilliant’s annual premium subscription! -- Video Note -- Sorry about the video desync in the intro, I accidently reversed the screen rec of the webpage so it doesn't quite line up!
@gyorgyreisch440
@gyorgyreisch440 Жыл бұрын
Thanks for this video, this is a topic which I couldn't resolve for some days, but now I can understand the basics.
@jonjmorrison
@jonjmorrison Жыл бұрын
You read my mind - just what I was looking for!
@mich9511
@mich9511 Жыл бұрын
Great series! Very impressive how easily you share knowledge. Yet it would be great to have values refreshed without reloading the whole page.
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
You can add a meta tag into the head section of the HTTP page to auto refresh at a specific interval eg every 5 seconds. Something along the lines of this:
@mytechnotalent
@mytechnotalent Жыл бұрын
Excellent job! I would love to see a REST API example as well do you have any plans to do that?
@jjfigueroafigueroa
@jjfigueroafigueroa Жыл бұрын
Please a video tutorial for Raspberry Pi Pico W - MQTT and AWS in C/C++
@ProXicT
@ProXicT Жыл бұрын
Thanks for a quick introduction into a web server on the Pi Pico! If I'm not mistaken, however, I reckon you might have a bug in your code in the cgi_led_handler() function: you're dereferencing the first element in the pcParam array, but you're not checking whether there is any by checking the iNumParams variable.
@limcheehean
@limcheehean Жыл бұрын
Is it possible to print the ip address in the serial console?
@chris.morel7
@chris.morel7 Жыл бұрын
Hi, thank you very much for this beautiful tutorial ! I have just one question. I would like to modify the html page displayed. How to know what hexadecimal values ​​to put in the htmldata.c file
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
Just edit the html files in the html folder. Then reconfigure the project and the htmldata.c file will contain the updated html files. Let me know how you get on!
@chris.morel7
@chris.morel7 Жыл бұрын
​@@LearnEmbeddedSystems Thanks for your answer. However i have a problem with the configuration. Here is the output : [cmake] Using PICO_EXAMPLES_PATH from environment ('G:\Code\Pico-example\pico-examples') [cmake] Running makefsdata python script [cmake] [cmake] Process failed because: The system cannot find the file specified [cmake] At the end, Cmake tell me that the configuration is done but the "htmldata.c" file didnt change. Any idea ?
@chris.morel7
@chris.morel7 Жыл бұрын
Nevertheless the "build" works perfectly
@chris.morel7
@chris.morel7 Жыл бұрын
@@LearnEmbeddedSystems I finally succeeded! When configuring the project the .py file was not running. So I launched it manually so that it converts the html file into a hexadecimal value
@ralf2961
@ralf2961 Жыл бұрын
A video to send mqtt messages from pico to a server with a mqtt client would be great.
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
Got it! Thanks for the idea :)
@anthonyrussano
@anthonyrussano Жыл бұрын
very cool
@l3chevalier
@l3chevalier 9 ай бұрын
I know the idea is to be introductory and, but I was expecting to go through a bit the changes made on the lwip optionals that were changed.
@stefanabageru4081
@stefanabageru4081 Жыл бұрын
Great video! I want to connect 2 rp via internet, so they do not share the same wifi. How could I do that?
@imax10000
@imax10000 Жыл бұрын
Is there a way to let the pico send and receive data and commands without a HTML website? For example I send a request over WiFi to switch a GPIO pin on or the pico returns the temperature sensor readings in JSON format?
@manfredbogner9799
@manfredbogner9799 3 ай бұрын
Sehr gut
@joseph9915
@joseph9915 Жыл бұрын
This is searching the HTML for strings, like a mini interpreter while the code is running? Couldn't the python script convert the .html directly to C strings and function calls that return the string values that change like On/Off?
@DIP2ndChannel
@DIP2ndChannel Жыл бұрын
Hello, is it solely possible to use only C programming language to build a web server inclusive of the LED ON and LED OFF buttons on the website too?
@DIP2ndChannel
@DIP2ndChannel Жыл бұрын
And can i clarify if i am able to input form on the web browser and submit the textbox to output into the pico w serial monitor?
@gyorgyreisch440
@gyorgyreisch440 Жыл бұрын
Based on this video and the Github I could re-compile and link this simple web server, it works as expected, I could switch on/off the LED, great! Thanks! But! I have a small hobby plotter project, my plotter's HW is more-or-less ready. I can handle the pen mechanism from the PicoW, I have the working C++ code for pen_up() and pen_down(). I use a SG90 servo motor, driving with a PWM pin. So I tried to combine the two knowledge, the Webserver and the pen_up, and pen_down fucntions. I see that as far as the webserver CGI handler tries to use the PWM, and would like to wait some time (till the HW made the movement), the PicoW immediately hangs. Hangs mean send a "Panic" trhought the USB. I found, that if I add a small sleep_ms(200); into the existing LED CGI handler, then it also hangs the PicoW! So not the PWM itself is the problem but waiting inside the CGI handler. I know that the PicoW has two cores. The first core is which starts the Wifi web service, which (I assume) runs on the second core (because the forever loop at the first core's end). I think that the CGI handlers runs also on the fist core, probably inside an interrupt handler. but I am not sure about this. Someone has an idea how can I program the PicoW (C or C++) to handle commands form the Webserver (like the LED on/off) which needs more time than setting a pin?! Handling motors, usually needs more time.
@RunningRunner46
@RunningRunner46 Жыл бұрын
huhu is the cgi handler the reason why the webserver is still triggered without putting it in an infinite loop? i just dont understand how it keeps on running
@RayBellis
@RayBellis Жыл бұрын
I get that you're probably doing it to simplify the video, but putting all that CGI and SSI code into .h header files instead of .c files is bad practice.
@aaroncatolico7550
@aaroncatolico7550 Жыл бұрын
For a very simple website, this could be useful. I wouldn't use it on any serious blog or ecommerce type of website or a mail server.
@staffahliindomitelur9160
@staffahliindomitelur9160 11 ай бұрын
is it posible to install dns resolver on sta mode?
@cernejr
@cernejr Жыл бұрын
I want to do something similar using and old smartphone in place of the pi-pico-w. Preferably Android. Any advice anybody? Libraries, etc.
@AKSKMY
@AKSKMY Ай бұрын
Anyone trying with PICO W 2024 directly clone the repo and change the WIFI SSID but serial monitor only opens and nothing happens afterwards?
@jw-mc7ip
@jw-mc7ip Жыл бұрын
Thank you for this video! How did you get the IP of the pico, though? I'm not quite sure how you got to the HTML webpage.
@petercolevas2179
@petercolevas2179 Жыл бұрын
did you ever figure this out?
@jw-mc7ip
@jw-mc7ip Жыл бұрын
I added in my own code to print out the IP address of the pico!@@petercolevas2179
@theegameer12
@theegameer12 Жыл бұрын
​@@petercolevas2179 I was having the same problem with finding the IP where the webpage is displayed. After the wifi connection is done, you can use: char *ip = ipaddr_ntoa(netif_ip4_addr(&cyw43_state.netif[0])); printf("WEBPAGE SERVED AT: %s ", ip); I hope it helps!
@bizarrocebola
@bizarrocebola Жыл бұрын
Bonjour, Projet vraiment sympa mais sur Visual studio windows, Code message : build -G Ninja exited with code: 1 Essayé sur raspberry pi 4 et même message. Auriez-vous une idée? Merci
@danman32
@danman32 10 ай бұрын
This tutorial was very helpful but the concepts presented seems to be limiting what one can do, particularly since it seems the pages are provided through "files" that seem to be static. How do you support multiple web pages, or pages that will have a variable # of elements, which needs to be built dynamically? Example: present a page that is generated by a variable number of array elements that represent different display tests. I had a big fight with ChatGPT on how to ask a client for a file, then read that file from the client in 256 byte chunks. It originally wanted me to us an SDK library and function from SDK going back to 2022 where the HTTP callback itself is handled by the application, determining what the URI being requested is, and if what request it is: GET, POST, etc. But I don't see how that can work with the approach in this tutorial. I presented the approach for this tutorial, hoping a CGI call could be leveraged. However ChatGPT had me construct a form with a submit action, which it expected would call the CGI. The client submit was interpreted by the Pico web server as a URI page request, where the page didn't exist. In order to be a CGI call, it has to be parameters in the URI, not in the post body. So how do we ask for a file, obtain the file name, being sure it is a valid file type, then pull the file 256 bytes at a time?
@danman32
@danman32 9 ай бұрын
Buyer? Buler?
@Chris-io2cs
@Chris-io2cs Жыл бұрын
I dont see why cyw43_arch_gpio_put is needed.. Can you not just use normal gpio_put functions along with any other logic youd want to do at that point?
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
The on board LED of the Pico is not connected directly to the GPIO on the RP2040. It is connected to the CYW43 network chip GPIO. The function cyw43_arch_gpio_put sends a command to the CYW43 device to toggle it's GPIO and turn that LED on. Hope this helps!
@nil0bject
@nil0bject Жыл бұрын
is it possible for the pico w to receive remote network requests? i can't get it to port forward
@LearnEmbeddedSystems
@LearnEmbeddedSystems Жыл бұрын
What are you trying to do with the Pico W? What do you mean by remote network requests specifically? The Pico W in this video doesn't have any port forwarding capabilities as it is simply a client on a network that is hosting a webserver
@nil0bject
@nil0bject Жыл бұрын
@@LearnEmbeddedSystems yeah, so how to access the website on the pico w from a remote(online) client? without using a forwarder/proxy like nginx. i've tried port forwarding on my router with no luck. perhaps NAT could be used?
@davidgreen9109
@davidgreen9109 19 күн бұрын
Sorry but you go WAAAY too fast.
FreeRTOS SMP on the RP2040 Tutorial - Symmetric Multiprocessing with FreeRTOS!
15:47
Getting Started with Multicore Programming on the Raspberry Pi Pico
11:14
Learn Embedded Systems
Рет қаралды 46 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 1,7 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 260 МЛН
WiFi Control Your Micropython Project Using a Web Interface
51:13
Bytes N Bits
Рет қаралды 31 М.
Raspberry Pi Pico 2: a RISC-V bet!
8:05
Jeff Geerling
Рет қаралды 302 М.
Pico W Episode 1: Setting Up the Raspberry Pi Pico W
12:48
Lori Pfahler
Рет қаралды 16 М.
In-depth: Raspberry Pi Pico's PIO - programmable I/O!
17:19
stacksmashing
Рет қаралды 139 М.
Raspberry Pi Pico W: Wireless Weather Station
17:13
ExplainingComputers
Рет қаралды 296 М.
3 HACKING gadgets you have to TRY!!
19:34
NetworkChuck
Рет қаралды 1,7 МЛН
The Raspberry Pi Pico WAS Overrated! But that changed!
10:18
GreatScott!
Рет қаралды 619 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 1,7 МЛН