Hello, everyone!
I am not a programmer as you will realise, but I set up a program for measuring weight with HX711 load cell for a uni project, and I would like to upload the measurments to my TS channel. The arduino UNO WiFi Dev board is connected to a WiFi network but I can't manage to make it work.
Before Setup, I defined the weight (3 decimals) and led (reading from A1)
#define CONNECTOR "rest"
#define SERVER_ADDR "api.thingspeak.com"#define APIKEY_THINGSPEAK " " //Insert your API Key
float weight = 0.000;
int led;
and in Loop
weight = scale.get_units();
pump = analogRead(A1);String uri = "/update?api_key=";
uri += APIKEY_THINGSPEAK;
uri += "&field1=";
uri += String(weight);
uri += "&field2=";
uri += String(led);Ciao.println("Send data on ThingSpeak Channel");
CiaoData data = Ciao.write(CONNECTOR, SERVER_ADDR, uri);
if (!data.isEmpty()) {
Ciao.println( "State: " + String (data.get(1)) );
Ciao.println( "Response: " + String (data.get(2)) );
}
//delay(30000); // Thinkspeak policy
else {
Ciao.println("Write Error");
}
The delay is commented because I use different time-step code.
The thing is that I can Serial.print the values of weight and led but not to upload them. However, when I give specific values to them it uploads without problem. Any help would be much appreciated.