The ThingSpeak Communication Library for Arduino has location functions:
ThingSpeak KEYWORD1
begin KEYWORD2
writeField KEYWORD2
setField KEYWORD2
setLatitude KEYWORD2
setLongitude KEYWORD2
setElevation KEYWORD2
writeRaw KEYWORD2
writeFields KEYWORD2
readFloatField KEYWORD2
readIntField KEYWORD2
readLongField KEYWORD2
readStringField KEYWORD2
readRaw KEYWORD2
getLastReadStatus KEYWORD2
I am unable to get these to work.
int setLatitude(float latitude)
{
#ifdef PRINT_DEBUG_MESSAGES
Serial.print("ts::setLatitude(latitude: "); Serial.print(latitude,3); Serial.println("\")");
#endif
this->nextWriteLatitude = latitude;
return OK_SUCCESS;
};
/**
* @brief Set the longitude of a multi-field update.
* To record latitude, longitude and elevation of a write, call setField() for each of the fields you want to write, setLatitude() / setLongitude() / setElevation(), and then call writeFields()
* @param longitude Longitude of the measurement (degrees E, use negative values for degrees W)
* @return HTTP status code of 200 if successful. See getLastReadStatus() for other possible return values.
* @see setField(), setLatitude(), setElevation(), writeFields()
* @code
void loop() {
int sensor1Value = analogRead(A0);
float sensor2Voltage = analogRead(A1) * (5.0 / 1023.0);
String sensor3Meaning;
int sensor3Value = analogRead(A2);
if (sensor3Value < 400) {
sensor3Meaning = String("Too Cold!");
} else if (sensor3Value > 600) {
sensor3Meaning = String("Too Hot!");
} else {
sensor3Meaning = String("Just Right");
}
long timeRead = millis();
ThingSpeak.setField(1, sensor1Value);
ThingSpeak.setField(2, sensor2Voltage);
ThingSpeak.setField(3, sensor3Meaning);
ThingSpeak.setField(4, timeRead);
setLatitude(42.2833);
setLongitude(-71.3500);
setElevation(100);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(20000);
}
* @endcode
*/
The example from the library however does not work and setLatitude() will not compile
any help with this would be appreciated
12