Ciao Uno Wifi Dev Ed Thingspeak State : 400

When my code below is included as part of a larger program it returns State : 400 ie an error and there is no update in Thingspeak.

The remaining features of the program are all OK ie an
attachInterrupt(pin_irq, IRQcounter, FALLING); //This is a small minimal code routine.
LCD display, WiFi Console, Serial Monitor all OK

When the same basic Ciao.write code is run by itself it returns State : 200 ie data is correctly sent and received by Thingspeak.

However when I include this function in the main program I get State : 400
I have tried using cli(); sei(); but this crashes the main program.

Using library Wire at version 1.0 in folder: /Users/mack/Library/Arduino15/packages/arduino/hardware/avr/1.6.19/libraries/Wire
Using library EEPROM at version 2.0 in folder: /Users/mack/Library/Arduino15/packages/arduino/hardware/avr/1.6.19/libraries/EEPROM
Using library Arduino_Uno_WiFi_Dev_Ed_Library at version 0.0.3 in folder: /Users/mack/Documents/Arduino/libraries/Arduino_Uno_WiFi_Dev_Ed_Library
Using library LiquidCrystal at version 1.0.6 in folder: /Users/mack/Documents/Arduino/libraries/LiquidCrystal
Sketch uses 19564 bytes (60%) of program storage space. Maximum is 32256 bytes.
Global variables use 1596 bytes (77%) of dynamic memory, leaving 452 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

Any suggestions please.

void uploadtothingspeak(){
String uri = "/update?api_key=";
uri += APIKEY_THINGSPEAK;
uri += "&field1=";
uri += String(savepulse_count1_kWh);
Serial.println(uri);
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)) );
}
else{
Ciao.println("Write Error");
}
}

this is probably a hint

Global variables use 1596 bytes (77%) of dynamic memory, leaving 452 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

that you need to stop using the String class and go back to basics with c-strings. that will free up some memory and avoid shooting holes into your heap (esp. the way you build your Strings with concatenation)

for more context on Strings, read this article The Evils of Arduino Strings

what is " Ciao.println("Send data on ThingSpeak Channel"); "?

thanks J-M-L.
I was aware of the memory hungry nature of Strings and now you have pointed out precisely where I should look.

I now have State : 200 (successful upload to Thingspeak) after some more careful use of the Uno memory eg using the F function ie Ciao.println(F("State :"); and int instead of float types.

I will now also study up on String theory.

Juraj
Ciao is a facility within the Arduino IDE which enables simple(?) web access via WiFi.
There is much info on the Forum etc

mackarduino:
Juraj
Ciao is a facility within the Arduino IDE which enables simple(?) web access via WiFi.
There is much info on the Forum etc

it has nothing to do with the IDE.

I only wasn't aware that Ciao object is a enhancement of WiFi object.

CiaoClass is derived from ArduinoWifiClass where the write to the WiFi console is implemented.

I would use WiFi.print to print to the WiFi console

But the possibilities of the factory firmware and the UnoWiFiDevEd library are so limited that I changed to WiFi Link firmware and then I wrote a SC16IS750 implementation running at 230400 baud.