Flashing code...if it does not flash magenta - Timeout

Everything was running smoothing with my spark core.

All of a sudden whenever I try to flash new code I get the error

Flashing code...if it does not flash magenta, verify your code and try again.

I then get a timeout error

I tried to do a factory reset. It worked, I was able to flash code twice and then the timeout error reappeared.

Any help would be appreciated.

It sounds like your code is causing the behavior. Can you share so that we can take a look if you dont mind?

I’m also having this problem, but only with some code…

int light = 0, high = 0, low = 1023;
char str[10];
int led = D7;

void setup() {
    pinMode(led, OUTPUT);
    Spark.variable("light", &light, INT);
    pinMode(A0, INPUT);
}

void loop() {
    light = analogRead(A0);

    autoTune();
    
    sprintf(str, "%i", light);
    Spark.publish("getLight", str, PRIVATE);
    
    digitalWrite(led, HIGH);
    delay(200);
    digitalWrite(led, LOW);
    delay(1000);
}

void autoTune() {
  if (light < low) {
    low = light;
  }
  
  if (light > high) {
    high = light;
  }

  light = map(light, low+30, high-30, 0, 255);
  light = constrain(light, 0, 255);
}

When I comment out this:

    Spark.publish("getLight", str, PRIVATE);

I can happily re-flash the device. Otherwise I have to factory reset the device every time I change code, which is tedious!

Any ideas?
Cheers

Hmm… Doesn’t look like there’s a serious issue. How often are you polling the light variable?

I am not sure if it is my code as it is happening with every piece of code I try, even example files such as the neopixel examples.

That’s odd. Maybe a cc3000 patch would fix it