Tutorial 3 — Connecting Arduino to the MIT WiFi Network
https://www.arduino.cc/en/Guide/MKRWiFi1010/connecting-to-wifi-network
#include <WiFiNINA.h>
#define SECRET_SSID "MIT"
#define SECRET_PASS "INSERT PASSWORD FROM CLASS"
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial);
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to network: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.println("You're connected to the network");
Serial.println("----------------------------------------");
printData();
Serial.println("----------------------------------------");
}
void loop() {
// check the network connection once every 10 seconds:
delay(10000);
printData();
Serial.println("----------------------------------------");
}
void printData() {
Serial.println("Board Information:");
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
Serial.println();
Serial.println("Network Information:");
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.println(rssi);
}
NOTE, ask if CONNECTING WITH THE ONLINE IDE IS EASIER!!!! It might be for this class (maybe we can share a WiFi password)