Spark Crash. Having trouble reading red blinks

Here is a video of the error codes:

I’ve followed the directions about the number of red blinks, but I can’t for the life of me count them. Anyone see what error code it is?

Here is a pastebin to my code. I’m thinking the problem is either in my use of the httprequest or the pid library I’m using but I can’t interpret the error so I don’t know what to look for yet.

@SHickson, on quick look, when referring to an a char array in Spark.variable(), don’t include the ampersand. So:

Spark.variable("temperature", &tempInfo, STRING);

Should be
Spark.variable(“temperature”, tempInfo, STRING);

Start with that :smile:

Whoops. I copied those lines from online and never thought to check them. Thanks @peekay123, fixing that and checking now.

Hi @SHickson

The error you are getting is one red flash which indicates a hard fault. This is similar to a segmentation violation on Window or other computers where you are following a bad pointer or using something as a pointer that isn’t one.

The way to read the red flashes is: first there is an SOS … — … pattern, the a pause and then the number of flashes for the error code. Then it repeats with SOS followed by error code.

As @peekay123 answered while I was typing this, the “&” is your problem most likely.


I checked the fault code page. It was just hard for me to visually see it because of how fast the blinks were and since I had never seen an example. It might be worthwhile to collect an example video of the different error codes for a point of reference. I ended up having to slow the video down on vlc to see it was a hard fault.

The crash still happens with the string lines fixed.

It works properly for a minute or so and then when I send it:
curl -d access_token=ACCESS_TOKEN -d "args=140"
It works and changes the variables properly and then a couple minutes later it still crashes.

@peekay123 That certainly helped. It is crashing less frequently now but still crashing occasionally after a few minutes of setting that variable.

Hi @SHickson

So the STRING variables do not need the “&”; they are are already the right kind of thing for a Spark.variable().

But the INT variable (“heating” your case) does need the “&” in front.

Is that where you have it now?

@bko Yes. I have:

    Spark.variable("temperature", tempInfo, STRING);
    Spark.variable("point", pointInfo, STRING);
    Spark.variable("pwm", pwmInfo, STRING);
    Spark.variable("heating", &heating, INT);
    Spark.variable("result",allInfo, STRING); 

I had just overlooked the ampersands when I copied the code.

1 Like

Interestingly enough I have removed the extra variable lines completely (Now I’m just using allInfo) and so far it hasn’t crashed at all. It’s possible the first flash with the ampersands removed wasn’t successful and I just didn’t notice. So it looks resolved.

Nevermind. It is still crashing just much less frequently. I’m going through the pid library and the rest of my code to see what could be going on. If anyone else sees anything obvious, let me know!

So I’ve been able to keep making it crash by setting the point temperature and then reading it with:

curl -d access_token=ACCESS_TOKEN -d "args=140"


curl -G -d access_token=ACCESS_TOKEN

Especially if I do them together fast. Is there anyway this can cause a hard fault or is it just coincidence?