SurferTim:
Maybe it is just me, but where are the includes and setup function?
Is the setup function really necessary? Like I said, every single GET request goes through to the server. It's just that some of the responses arent outputted to the serial terminal. However, every request gets a response from the server.
/* Standard Includes */
#include <string.h>
#include <stdlib.h>
/* WiFi library */
#include <WiFi.h>
#include "Credentials.h"
/* EEPROM Wire library */
#include <Wire.h>
#include <Debug.h>
/* MiRF Chip SPI library */
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
/* Program Variable Library */
#include "hub.h"
void setup() {
Serial.begin(BAUD_SERIAL);
Wire.begin();
radio.begin();
checkShield();
Serial.println("Hello World!\n");
connectToTheInternet();
delayFirstRun();
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.startListening();
}
void checkShield() {
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
}
void delayFirstRun(){
Serial.print("STARTING RADIO IN ");
for (int i=0; i<5; i++){
delay(1000);
Serial.print(5-i);
Serial.print("... ");
}
Serial.println();
}
void connectToTheInternet() {
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
}
Serial.println("Connected");
printWifiStatus();
}
SurferTim:
But despite that, you MUST wait for the server to close the connection. That is the signal it is finished. Once you are connected to the server, use this:while(client.connected()) {
while (client.available()) {
charRead = client.read();
Serial.print(charRead);
}
}
client.stop();
If the connection breaks (hardware fail enroute), you must include a timeout in that routine, but we will discuss that later.
My procedure does the same thing. The client.stop() isnt issued until the next getRequest() function is started. But I tried your suggestion as well, and it affect the problem. It actually made it worse, and none of the getRequests get a response.