Hi,
I have been playing with DHT22 sensors and was able to integrate both DHT22 and One-Wire temp/humid working on the same Core.
But, I had trouble and locked up my Core when I initialized a string with “INIT”:
...
char zError[24] = "INIT";
void setup()
{
Spark.variable("errorX", zError, STRING);
}
void loop()
{
int result = DHT.acquireAndWait();
switch (result) {
case DHTLIB_OK:
sprintf(zError , "OK");
break;
case DHTLIB_ERROR_CHECKSUM:
sprintf(zError , "Checksum");
break;
...
...
}
delay(2500);
}
If I simply change to:
char zError[24] = "";
Everything works as it should…
I found several topics on STRING and memory issues, some which were solved with hardware updates. I don’t know if my Core has been automatically updated, but I reset everything and just changed the “INIT” part, which solved my problem.
I get the impression that STRING is a difficult variable to handle, but I have not seen good examples of what one can (or should) do to master this important variable type.
Any thoughts ?
Marcus