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

  Рет қаралды 27,914

Learn Embedded Systems

Learn Embedded Systems

Күн бұрын

Пікірлер: 43
@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.
@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:
@jonjmorrison
@jonjmorrison Жыл бұрын
You read my mind - just what I was looking for!
@mytechnotalent
@mytechnotalent Жыл бұрын
Excellent job! I would love to see a REST API example as well do you have any plans to do that?
@ProXicT
@ProXicT 11 ай бұрын
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.
@jjfigueroafigueroa
@jjfigueroafigueroa Жыл бұрын
Please a video tutorial for Raspberry Pi Pico W - MQTT and AWS in C/C++
@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 :)
@manfredbogner9799
@manfredbogner9799 2 ай бұрын
Sehr gut
@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?
@DIP2ndChannel
@DIP2ndChannel 11 ай бұрын
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 11 ай бұрын
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?
@anthonyrussano
@anthonyrussano Жыл бұрын
very cool
@limcheehean
@limcheehean Жыл бұрын
Is it possible to print the ip address in the serial console?
@l3chevalier
@l3chevalier 8 ай бұрын
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.
@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.
@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?
@jw-mc7ip
@jw-mc7ip 11 ай бұрын
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 11 ай бұрын
did you ever figure this out?
@jw-mc7ip
@jw-mc7ip 11 ай бұрын
I added in my own code to print out the IP address of the pico!@@petercolevas2179
@theegameer12
@theegameer12 10 ай бұрын
​@@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!
@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.
@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.
@AKSKMY
@AKSKMY 8 күн бұрын
Anyone trying with PICO W 2024 directly clone the repo and change the WIFI SSID but serial monitor only opens and nothing happens afterwards?
@RunningRunner46
@RunningRunner46 10 ай бұрын
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
@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?
@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 8 ай бұрын
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 8 ай бұрын
Buyer? Buler?
@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.
@staffahliindomitelur9160
@staffahliindomitelur9160 10 ай бұрын
is it posible to install dns resolver on sta mode?
@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?
FreeRTOS SMP on the RP2040 Tutorial - Symmetric Multiprocessing with FreeRTOS!
15:47
Beginner for Node-RED, InfluxDB & Grafana
36:23
Nur Hanani Ahmad Puaad
Рет қаралды 47 М.
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 80 МЛН
World‘s Strongest Man VS Apple
01:00
Browney
Рет қаралды 68 МЛН
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,2 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 21 МЛН
Raspberry Pi Remote Access - 3 Methods
25:12
DroneBot Workshop
Рет қаралды 36 М.
WiFi Control Your Micropython Project Using a Web Interface
51:13
Bytes N Bits
Рет қаралды 30 М.
Turning a Raspberry Pi Pico into a GPU!
16:42
element14 presents
Рет қаралды 125 М.
DON'T Use Raspberry Pis for Servers! (Use THIS)
16:23
Hardware Haven
Рет қаралды 1,1 МЛН
How To Setup a HTTP Web Server With Raspberry Pi Pico W (using WiFi)
9:23
Every Developer Needs a Raspberry Pi
27:27
Sam Meech-Ward
Рет қаралды 750 М.
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 340 М.
Making Minimalist Web Server in C on Linux
10:23
Nir Lichtman
Рет қаралды 249 М.
Raspberry Pi versus AWS // How to host your website on the RPi4
8:39
5 Ways Pi Pico 2 Takes Your Projects to the Next Level
5:15
Hardware.ai
Рет қаралды 10 М.
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 80 МЛН