Glad that code is working fine.
Thanks for the suggestion
Checked if variable is working:
Code:
int analogvalue = 0;
double tempC = 0;
char *message = "my name is spark";
void setup()
{
// variable name max length is 12 characters long
Spark.variable("analogvalue", &analogvalue, INT);
Spark.variable("temp", &tempC, DOUBLE);
Spark.variable("mess", message, STRING);
pinMode(A0, INPUT);
}
void loop()
{
// Read the analog value of the sensor (TMP36)
analogvalue = analogRead(A0);
//Convert the reading into degree celcius
tempC = (((analogvalue * 3.3)/4095) - 0.5) * 100;
Delay(200);
}
Flashed it to core. Polled for variable mess output from curl:
{
"ok": false,
"error": "Variable not found"
}
I also did spark variable list My core has 0 variables or is offline - but core is breathing cyan and the flashed code has variable.
You might want to check the status of port 5683 on your router. From the doc page:
The only change you may need to make to your router is to open up outgoing port 5683, the default CoAP port the Spark Core uses to connect to the Spark Cloud. If your core flashes cyan and occasionally flashes red, router issues are likely the culprit.
From my experience, if outbound TCP 5683 is blocked, you won't even get to the breathing cyan part. However, different routers could work in mysteriously different ways. Double-NAT, IDP, etc. We do a lot of VOIP here at work, so we've seen some very interesting issues with customer equipment and ISPs.
I don't suppose you have a different Core to test or can try a different network with a different router/firewall? Have you tried testing with just a single Spark.variable() or Spark.publish() with simple, static values?