Answer the question
In order to leave comments, you need to log in
Why does the value of a string in memory change in Arduino?
I have a list of structures which is stored in a class as a pointer to the first element of the list:
struct SensorValue {
String name;
double value;
bool constantly;
SensorValue *next;
};
void Cloud::sendValue(String name, double value, bool constantly) {
SensorValue newSensorValue;
newSensorValue.name = name;
newSensorValue.value = value;
newSensorValue.constantly = constantly;
newSensorValue.next = NULL;
addSensorValue(&newSensorValue);
}
void Cloud::addSensorValue(SensorValue* value) {
if (sensorsList == NULL) {
sensorsList = value;
return;
}
SensorValue* iter = sensorsList;
while (iter->next != NULL)
iter = iter->next;
(iter->next) = value;
}
String requestBody = "{\"login\":\"" + login + "\",";
requestBody += "\'password\':\"" + password + "\",";
requestBody += "\"deviceName\":\"" + device + "\",";
requestBody += "\"deviceType\":\"Arduino\",\"sensorsValue\":{";
SensorValue* iter = sensorsList;
Serial.println(sensorsList->name);
Serial.println(sensorsList->value);
Serial.println(sensorsList->next == NULL);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question