DEV Community

Cover image for How to connect Arduino UNO Wifi Rev.2 to WiFi
Bartosz Mikulski
Bartosz Mikulski

Posted on

How to connect Arduino UNO Wifi Rev.2 to WiFi

Installation

When you connect the board for the first time to the USB port, the IDE should detect it and install the required drivers.

When you have the drivers installed, make sure that you choose the proper type of Arduino.

You should select the following settings in the Tools window.

Now, you should go to the Tools -> Manage libraries window and install the WiFiNINA library:

Connecting to WiFi

Now, you are ready to copy the example code from https://www.arduino.cc/en/Tutorial/WiFiNINAWiFiPing

Before you run it, click the arrow button in the top right corner and choose the "New Tab" option.

We need to create an arduino_secrets.h file which contains the following code:



#define SECRET_SSID "YOUR_NETWORK_SSID"
#define SECRET_PASS "YOUR_NETWORK_PASSWORD"


Enter fullscreen mode Exit fullscreen mode

Save the file and return to the file which contains the code copied from the example.

Make sure that your Arduino is connected to the USB port and click the Upload button.

Testing

Click the Tools menu and open the "Serial monitor" window.
You should see something like this:

If you see a similar result, it means that everything works fine.
Now, you can start removing the redundant code from the example and adding your code.

Just make sure to keep this part of the setup and your arduino_secrets.h file:



#include "arduino_secrets.h" 
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
int status = WL_IDLE_STATUS;

void setup() {
  while ( status != WL_CONNECTED) {
    status = WiFi.begin(ssid, pass);
    delay(5000);
  }

# your code here
}


Enter fullscreen mode Exit fullscreen mode

Top comments (0)