Core keeps power cycling for Cloud Connection

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);
    }
    
}

Think I’ve got it back now - fired a factory reset on it and that seemed to get it back for me. very weird though

1 Like

Hi @elbeardo,

That’s just what I was going to suggest. :slight_smile: I’m not entirely sure what would be breaking in that code, but it sounds like people have seen missed connections cause things to time out, or sometimes too many connections are opened and I think that can cause issues. Just in case that’s the case I’m going to log a bug and make sure we check that out.

Thanks,
David