Hi,
I have a system that sends data to Google sheets with Arduino WIFI Rev 2 using PushingBox. After 11 iterations of sending data a "No Socket Available" message appears on the serial monitor, and the data doesn't pass to Google Sheet.
I've tried upgrading my Firmware to 1.8.13, it didn't fix it.
I've tried to use client flush(); and client stop(); , it didn't fix it.
This is the code im using:
#include <SoftwareSerial.h>
#include <WiFiNINA.h>
#include <SPI.h>
const char WEBSITE[] = "api.pushingbox.com"; //pushingbox API server
const String devid = "this is my device id "; //device ID on Pushingbox for our Scenario
const char* MY_SSID = "Assaflrr";
const char* MY_PWD = "0542402893";
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();
}
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");
}
void loop() {
// Wait between measurements.
delay(10000);
int humidityData = 1;
int celData = 2;
int fehrData =3;
int hifData = 4;
int hicData = 5;
Serial.print("Humidity: ");
Serial.print(humidityData);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(celData);
Serial.print(" *C ");
Serial.print(fehrData);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hicData);
Serial.print(" *C ");
Serial.print(hifData);
Serial.println(" *F\n");
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
+ "&humidityData=" + (String) humidityData
+ "&celData=" + (String) celData
+ "&fehrData=" + (String) fehrData
+ "&hicData=" + (String) hicData
+ "&hifData=" + (String) hifData
);
// 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();
Serial.println("\nData Sent");
}
}
Im really stuck on this one, any help is appriciated.
Thank you!