Closed kenneth558 closed 2 years ago
AP mode works and there is an example you can check out from the IDE.
Are you sure you want AP mode? If you want to serve a web page that you can access anywhere on your network you don't need AP mode at all, just a WebServer
and normal (STA) mode. AP mode makes a new hotspot that you need to manually connect your phone or laptop to (i.e. disconnect from home Wifi, connect to Pico hotspot).
I suggest you swap your cores. Core0 runs the USB and also really should be the one doing any WiFi operations. Core1 is 100% unused by default.
Great advice! And Yes, I do want the devices to function autonomously without the need for any other wifi whatsoever. At the same time, there will be other situations that your thinking is the most flexible, so BOTH will need to exist depending on the environment.
I trust you saw the line of code above:
server.setNoDelay(true); //no such member. Time to wonder if Arduino IDE will even work
where I am led to suspect I'm mixing libraries or something. I'll stay the course and swap core functions. Thank you!!!!
I didn't go over the code, no. There are several issues as you noted. server.begin()
should only be called once. setNoDelay
is only a per-TCP connection thing, not a server one, and it is only a hint to the TCP/IP stack to send data immediately (i.e. lots of little packets) instead of waiting a bit to possibly combine transmits (i.e. fewer, larger packets with less overhead).
This doesn't look like a core issue so I'm going to move to a discussion...
I'm starting with a project I wrote with Arduino IDE in Linux Mint I'm porting - going from non-wifi Arduino environment to RPi Pico W in hopes of enhancing the way continuous real-time data will be streamed from my training aid to the user/student. The Arduino version of this project simply sent the data over USB to the Arduino IDE plotter tool, but I hope to change from USB to wifi - utilize the second core of the RPi Pico W to serve a web page (continuous real-time data will be a secondary challenge for sure). As I study this out and make feeble attempts with this notion, I sense there is a lack of software tools to do this with the Arduino IDE in c++ that would allow me not to have to port the entire project into micropython or take it into the RPi SDK, or other frameworks/environments. As trivial as those two+ options MIGHT or MIGHT NOT be, I certainly don't feel adequately knowledgeable to embark down either one confident that I'm accurately foreseeing the complexity either would present.
All has gone according to plan in bringing the project's full Arduino-level functionality into the RPI Pico W environment, separating out the circuitry control workload to core 0 and the data streaming workload to core 1. But getting the core I've designated for data streaming USB+wifi data fails at the step of the Pico W becoming an AP from which to serve a web page. It does not appear to broadcast wifi at all - I don't see any available for me on my Android to select. Note I am not explicitly including any wifi.h:
My next troubleshooting step was to investigate the reality of your note I see that says "Add AP mode with simple DHCP server" in your July 15 comments for "Add Pico W WiFi support". I don't find the code for that capability anywhere in my Arduino IDE menus to allow me to make any troubleshooting steps in that direction I hoped to go.
Is the Arduino IDE up to the task for a web server on the RPi Pico W, yet? Or do I have to get born again into a different framework? Or is some mistake in the above code my only problem? Maybe I am mixing incompatible libraries (b/c this compilation becomes unstable within a few seconds)? Thank you for pointing me to the right path for success!!!!!