I'm trying to connect to Dweet.io (or any web site) with the WiFi Rev 2 board. I have connection to my local WiFi but connect to an external page fails. Any idea what my problem is?
Here's a sample:
#include <SPI.h>
#include <WiFiNINA.h>
#include "ArdUtils.h"
#include "WiFi_secrets.h"
const char* ssid = SECRET_SSID;
const char* pass = SECRET_PASS;
IPAddress ip(192, 168, 1, 50);
WiFiClient client;
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("Start...");
//connectToWiFi();
WiFi.setHostname("UnoWifiRev2"); // Doesn't work. Router says name is arduino-eb3c
WiFi.config(ip);
if (WiFi.begin(ssid, pass))
{
Serial.print(F("Connected to "));
Serial.println(WiFi.localIP());
}
else
{
Serial.println(F("Could not connect to network"));
}
if (!client.connect("dweet.io", 80)) // http://34.202.255.213/
//if (!client.connect("34.202.255.213", 80))
//if (!client.connect("google.com", 80))
Serial.println("Dweet Connection failed");
else
Serial.println("Connected to Dweet");
}
void loop()
{
// put your main code here, to run repeatedly:
blinkLedNoDelay();
}