Hello Newbee,
The most important thing is to start with the most minimalistic program that is possible in your project,
I guess for Arduino Cloud-IoT there are some examples. Did you manage to make one of the pre-written examples to work?
If you have a working example modify in small steps towards your needs.
Too much modifiying at once in combination with too less knowledge leads to a big mess that slows everything down.
Thanks for your reply. You are ofcourse right and yes i have also tried to use the ArduinoIotCloud-Basic Example from the ARDUINOIOTCLOUD Example Librarie, which does more or less the same thing as my own sketch. This has led to the same result. And I have also tried to turn the LED on and off directly via digitalWrite(LED_BUILTIN, HIGH) which has worked.
It seems to me that I am doing something wrong with the connection between IoTCloud and the device but I can't figure out what.