From time to time I see the same value gets returned from two variables. For example, I have two tmp36 hooked up, one inside and one outside, both return expected values normally, but this morning at 0559 BST they both returned the same value:
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’in_temp’, u’result’: 809}”
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’out_temp’, u’result’: 809}”
The previous values were consistent, at 0554 BST:
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’in_temp’, u’result’: 810}”
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’out_temp’, u’result’: 739}”
The subsequent values are consistent as well, at 0604 BST:
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’in_temp’, u’result’: 809}”
“{u’coreInfo’: {u’last_handshake_at’: u’2014-06-18T19:38:41.148Z’, u’connected’: True}, u’cmd’: u’VarReturn’, u’name’: u’out_temp’, u’result’: 747}”
In the graph the blue line is “in_temp” and the black line is “out_temp”. I see this problem maybe once a day, and its not always the same variables.
I initialise the variable
int in_temp = 0;
int out_temp = 0;
In setup() I have:
Spark.variable("in_temp", &in_temp, INT);
Spark.variable("out_temp", &out_temp, INT);
and in main() I have:
in_temp = analogRead(A7);
out_temp = analogRead(A6);
I have nothing else which touches these variables.
I thought initially my sensors were reporting badly, but then I noticed that each time I had a spike two of variables I was recording had the same value, so then i thought my code which logs the data was causing the issue, so I started logging the results from the API to compare against what I had in my database. Have I stumbled across a bug in the API or the spark firmware, is there a way to look historically at what values my sparkcore is reporting, should I hook up a serial line to the sparkcore and record the values?