After flashing a new program to my core (it was connected to the cloud before and running the program fine). I can no longer get the core to connect to the Spark Cloud. It just keeps power cycling, pausing on cyan for 2 seconds and then restarting.
Any suggestions?
Code used below:
int LED = D7;
//Broadcast to server
TCPClient client;
char url[] = "192.168.2.2";
char request[] = "GET /Magni/index.php?type=start&core=HELLLLO HTTP/1.0";
char request2[] = "GET /Magni/index.php?type=alert&core=HELLLLO2 HTTP/1.0";
int port = 8080;
void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
if(client.connect(url, port)){
client.println(request);
client.print("HOST: ");
client.println(url);
client.println("Connection: close");
client.println();
client.flush();
}
}
void loop() {
if(client.connected()){
digitalWrite(LED, HIGH);
}else{
if(client.connect(url, port)){
client.println(request2);
client.print("HOST: ");
client.println(url);
client.println();
client.flush();
digitalWrite(LED, HIGH);
}
digitalWrite(LED, LOW);
}
}