[SOLVED]Spark Dev flashing core says 'undefined...'

Just tried flashing my core but Spark Dev (v 0020) says ‘undefined…’ in the info line at the bottom. My core is connected to the cloud and I can access the variables via curl. But it never starts flashing purple.

Any suggestions what is going on?

Found the problem: sin(x) is not included in "math.h"
It is very confusing that it compiles without any errors.

1 Like

Hi @MarkusL, I am having the same problem in that when I try to flash my core from Spark Dev I get an undefined… message like you did. My code compiles without errors.

My code does #include math.h

Please can you elaborate on your solution please? math.h is not a file in my compile folder. I think it is “added at source”.

Many thanks

@Julian, @MarkusL, the math library, like “application.h” is part of the core firmware environment. I believe the correct syntax for including the file, which includes sin(), is:

#include <math.h>


1 Like

Hi @peekay123, I was not sure if I should open a new thread for my issue? It just seemed similar to @MarcuL 's. I have some code that compiles in the cloud with no errors but won’t flash. I am using spark dev. (Which I think is brilliant, apart from this issue). The error message at the bottom of the spark dev window is not very descriptive- it just says “undefined…”? What does it think is undefined? Is there some way to get the rest of the error message out of it?

Thanks :smile:

Hi @peekay123,

The code I am trying to flash in spark dev has the line

 #include "math.h"
#include "ADAFRUIT_MAX31855.h"

Should I replace the "math.h" with <math.h>?

It compiles without errors but won’t flash?


i’m using it successfully like this:

#include <math.h>

in the Spark Dev environment.

@Julian, try what @BulldogLowell is suggesting though both should work. This may be one of those weird compiler issues so let us know the results. If it still doesn’t flash then it may be another issue altogether. :grinning:

I want to say that I recall having to use:

#include <application.h>
#include <math.h>

for it to compile, though I just commented it out of a working program… and gosh darn it it compiles. Bad memory perhaps (or maybe I had to put it in to compile on the Web IDE).

Hi @peekay123
afraid to say that I am still having issues with this. I can not seem to flash my core from spark dev. The code compiles OK then I get a message undefined… when trying to flash.

Is there some way I can get more information than the undefined… message? It looks like there is more to the error statament than “undefined”. Is there some way to open a console or extract the error code in spark dev?

Thank you.

@Julian, can you please post your code or a link to it? :smiley:

@peekay123, Thank you very much for looking, my code is:-

  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

  Designed specifically to work with the Adafruit Thermocouple Sensor
  ----> https://www.adafruit.com/products/269

  These displays use SPI to communicate, 3 pins are required to
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution

#include <math.h>
#include "ADAFRUIT_MAX31855.h"

int thermoCLK = A3;
int thermoCS = A2;
int thermoDO = A4;

Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
//double svc = 0;
double c = 0;
// double cir = 0;
void setup() {
  // open serial terminal and press ENTER to start
Spark.variable("temperature",&c, DOUBLE);
//  while(!Serial.available()) SPARK_WLAN_Loop();

  Serial.println("MAX31855 test");
  // wait for MAX chip to stabilize

void loop() {
  // basic readout test, just print the current temp
   Serial.print("Internal Temp = ");

   c = thermocouple.readCelsius();
  // cir = thermocouple.readInternal();
Spark.publish("ThermoCoupleEvent", String(c),10,PRIVATE);

   if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {
     Serial.print("C = ");

   //Serial.print("F = ");


If I change the “” for <> around ADAFRUIT_MAX31855 it will not compile in spark dev. As posted above it will compile, product a .bin file, say it is flashing and then fail. The core I am flashing does not change from breathing cyan during the process.

Thank you.


@Julian, this is not quite correct! First:

#include "ADAFRUIT_MAX31855.h"

needs to be a dash not an underline:

#include "ADAFRUIT-MAX31855.h"


Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);

needs to not have the underline:

AdafruitMAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);

Everything else if fine. Give it a shot! :stuck_out_tongue_winking_eye:


Thanks for your reply. I should say that I am not using the @mumblepins “new” library. That one does have - not _ in the name. I should also say that the .cpp file and .h file in my compile folder are named ADAFRUIT_MAX31855.cpp and ADAFRUIT_MAX31855.h

Your second amendment might depend on the first but when I remove the _ in the Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
I get an error on compiling.

Thanks again for looking. Maybe I SHOULD switch to the mumblepins library.


@Julian, I would need the library you ARE using to be able to help you further. :wink:

@peekay123, Thank you! Do you still have that google drive link I PM’d you? That is the library I am using.

Is that OK or should I post the library code here?


@Julian, the mumblepins library is a much better library since it can use software or hardware SPI. Regardless, I did get your (old) library and was able to compile without problems on SparkDEV. I also had no problems flashing it via the Cloud to a Core of mine and it got to a breathing cyan and it was spewing out messages on the serial port.

HOWEVER, no matter how much I cut the code down to just the Spark.variable and the Spark.publish, I could not get the two to work. Commenting one out made the other work. I really am not sure what gives. I would take out one since both are redundant IMO.