Arduino MKR1000 unable to connect to iPhone WiFi hotspot

Hello,

I’m working on making a soil moisture monitor for a final project for one of my college classes. This is the first time I’ve had to use Arduino and I’m having a few issues. I’m still living at school, and for some reason the school WiFi will not allow me to connect for this project, so I’m using the hotspot on my iPhone.

I’ve tried using both the web editor and the app, and I’m getting different errors on the web editor than the app. On the web editor the error I’m getting is “Serial port busy” and on the app, I just get “Attempting to connect to SSID:…” on a loop.

This is the code I’ve been given by my professor, minus the information I would have to enter, which he told me was fine:

<

#include <WiFi101.h>
const char WEBSITE = “api.pushingbox.com”; //pushingbox API server
const String devid = “XXXXXXXX”; //device ID on Pushingbox for our Scenario
const char* MY_SSID = “XXXXXXX”;
const char* MY_PWD = “XXXXXXXX”;
// the loop routine runs over and over again forever:
void loop() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// read the input on analog pin 0:
delay(1000); // delay in between reads for stability
float moistureHum = analogRead(A1);
moistureHum = (1023 - moistureHum) * 100/1023;
// print out the value you read:

Serial.print(“Humidity: “);
Serial.println(moistureHum);
Serial.print(” %\t”);
Serial.println("\nSending Data to Server…");
// if you get a connection, report back via serial:
WiFiClient client; //Instantiate WiFi object, can scope from here or Globally
//API service using WiFi Client through PushingBox then relayed to Google
if (client.connect(WEBSITE, 80))
{
client.print(“GET /pushingbox?devid=” + devid

  • “&moistureHum=” + (String) moistureHum);

// HTTP 1.1 provides a persistent connection, allowing batched requests
// or pipelined to an output buffer
client.println(" HTTP/1.1");
client.print(“Host: “);
client.println(WEBSITE);
client.println(“User-Agent: MKR1000/1.0”);
//for MKR1000, unlike esp8266, do not close connection
client.println();
Serial.println(”\nData Sent”);
}
}
void printWifiStatus() {
// print the SSID of the network you’re attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield’s IP address:
IPAddress ip = WiFi.localIP();
Serial.print(“IP Address: “);
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print(“signal strength (RSSI):”);
Serial.print(rssi);
Serial.println(” dBm”);
}

int status = WL_IDLE_STATUS;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println(“WiFi shield not present”);
// don’t continue:
while (true);
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED)
{
Serial.print("Attempting to connect to SSID: ");
Serial.println(MY_SSID);
//Connect to WPA/WPA2 network.Change this line if using open/WEP network
status = WiFi.begin(MY_SSID, MY_PWD);
// wait 10 seconds for connection:
delay(10000);
}

Serial.println(“Connected to wifi”);
printWifiStatus();

}

This project is due 12/9, and I was told that I could still get a passing grade if it were unfinished, but I would really like to finish this project.

Thanks so much :slight_smile:

What made you think that your question has anything to do with the Website and Forum section which is clearly stated to be for "Improvements for the web system, applications to moderator, spam, etc."? I have suggested to the Moderator to move it to the Networking section.

This sort of carelessness makes unnecessary work for the Moderators.

...R

@baschoen

Your topic was Moved to it's current location / section as it is more suitable.

Link you bypassed on the way in !
Could you also 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.