Go Down

Topic: Arduino Uno Wifi Rev 2 WiFi setup (Read 15695 times) previous topic - next topic

kristiqpham

Hello, I am trying to setup my Arduino Uno Wifi Rev 2 connected to a power bank. I am having trouble finding the serial port for it when first connecting it. It works fine when it is hardwired to my laptop, but I am wanting to use the WiFi capabilities in order to run my code through a local web server. Are there any tutorials on basic WiFi configurations?

rtek1000

Please avoid private messages, your question may be someone's answer in the future!

rtek1000

Code: [Select]
#include <SPI.h>
#include <WiFiNINA.h>

char ssid[] = "test";
char pass[] = "";
int keyIndex = 0;

int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600);

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
    delay(10000);
  }
  server.begin();

  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
}

void loop() {
  WiFiClient client = server.available();   
  if (client) {                             
    Serial.println("new client");           
    String currentLine = "";               
    while (client.connected()) {           
      if (client.available()) {             
        char c = client.read();             
        Serial.write(c);                   
        if (c == '\n') {                   

          if (currentLine.length() == 0) {

            client.println("Hello World");

            break;
          } else {
            currentLine = "";
          }
        } else if (c != '\r') {
          currentLine += c;
        }
      }
    }

    client.stop();
    Serial.println("client disonnected");
  }
}


Source: Arduino Uno with WiFi Basic Setup
Please avoid private messages, your question may be someone's answer in the future!

rtek1000

Please avoid private messages, your question may be someone's answer in the future!

ballscrewbob

@kristiqpham

Moved your topic to it's current location as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

kristiqpham

That is the code i'm using. It compiles but I'm not able to upload it since I'm not connected to any port. Nothing is showing up under the ports to select from. I've powered it on by connecting it to the power bank, am I missing a step in between?

Go Up