Uno R4 Wifi Access Point

Hi,

I have an Arduino Uno R4 Wifi, and I would like to use it to make measurements and simply display them on a web page, that I can access via my computer, I would be glad to get a bit of help.

In Examples, I dived into the "Examples for Arduino Uno R4 Wifi".
I tried WifiS3 -> AP_SimpleWebServer.ino. I can connect to the networks, it kind of works, even though the 2 buttons actually do the same thing : the LED gets barely turned on for half a second, shortly blinks and fades, and client gets disconnected.
I also tried WifiS3 -> SimpleWebSeverWiFi.ino. No networks shows up, I can't connect to anything.

These 2 sketches are from 2012. Am I looking at the right place?
I simply want a sketch that starts an access point and prints out analog input data or "Hello world". How can I do that?

Thanks

It sounds like you are confusing an Access Point with a Webserver. If you want the page to be available on your normal WiFi network then try WifiS3 -> SimpleWebSeverWiFi.ino again.

Have you entered your WiFi Access point name and password into arduino_secrets.h and changed the baud rate of Serial.begin() if you don't want it to be 9600 ?

Uploading the sketch and resetting the board should output something like this in the Serial monitor

Attempting to connect to Network named: Your_Access_Point_Name
SSID: Your_Access_Point_Name
IP Address: 192.168.1.118
signal strength (RSSI):-42 dBm
To see this page in action, open a browser to http://192.168.1.118

Open the given IP address in your browser. What do you see ?

Thanks. Yes I entered a ssid name and a password in the arduino_secrets.h window.
The baud rate in the IDE is set to 9600 like in the sketch.
I tried again, but still no wifi created. The output is :

Attempting to connect to Network named: ssid_test
Attempting to connect to Network named: ssid_test
Attempting to connect to Network named: ssid_test
Attempting to connect to Network named: ssid_test

Is the name of your normal WiFi really ssid_test ?

Is that the SSID that you normally connect to using your 'phone and/or PC or did you just make that up to test the sketch ?

For the WifiS3 -> SimpleWebSeverWiFi example you need to enter the SSID and password for your existing WiFi connection

I thought the Uno was going to be the server (or AP? sorry, I am confused), creating a wifi network to which my laptop would connect to download the measurements output.
So this is the other way around? The wifi comes from my phone, but I thought this wifi had nothing to do with this setup.

Remember what I said ?

The WifiS3 -> SimpleWebSeverWiFi example creates a webserver on your existing WiFi network, hence the need to enter your current WiFi SSID and password. The WifiS3 -> AP_SimpleWebServer example creates a new Access point that is not on your WiFi network and runs a webserver that you can access on that new Access Point. For this example you provide the SSID and password needed to access the new Access Point

If you want to use your current WiFi network to see data from the Arduino and also connect to other things on the network then use the first example but if you want to create a separate Access Point and webserver use the second example

To me the first option makes more sense as you cannot connect your PC/phone/tablet to more than one WiFi network at a time, at least not normally

Indeed that's more convenient!
Awesome, I understand. Now, how do you print out a "Hello World" on the web page?
In my case it is http://192.168.180.44/
Thanks for your help.

HTML is not my strong point, but this code section is what prints the messages to the screen

            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");
            
            // The HTTP response ends with another blank line:
            client.println();

Basically it creates the HTML code required by "printing" to the webserver, ie the client

Try this crude example in place of the code above

            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");
            
            // The HTTP response ends with another blank line:
            client.println();
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
            client.println("Hello World");
            // client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            // client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");
            
            // The HTTP response ends with another blank line:
            client.println();

Then go and read up on HTML to do it properly !

Oops, I could I done it by myself, it was all in the code :zipper_mouth_face:
It works perfectly. Thank you so much !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.