Can`t serialprint a float

i can`t Serialprint..... float humidity; , float temperatuur; .
but moisture1 and moisture2 wil work.


/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/46393064-606f-460a-821b-aec2ef57c7c7 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  float humidity;
  float temperatuur;
  int moisture1;
  int moisture2;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/


#include "thingProperties.h"

int i = 0;
unsigned long starttime = millis();



void setup() {
  // Initialize serial and wait for port to open:
  //Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  Serial.begin(9600);
  Serial2.begin(115200);
  
  delay(1500); 
  
  
  

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  Serial.print("\n(");
  Serial.print(i++);
  Serial.print(") CloudCon = ");
  delay(2000);
 
 
 
}




/*
  Since Temperatuur is READ_WRITE variable, onTemperatuurChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onTemperatuurChange()  {
  // Add your code here to act upon Temperatuur change
  Serial.print("Temperatuur=");
  Serial.println(temperatuur);
  
  
}

/*
  Since Moisture1 is READ_WRITE variable, onMoisture1Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onMoisture1Change()  {
  // Add your code here to act upon Moisture1 change
  Serial.print("Moisture1=");
  Serial.println(moisture1);
}

/*
  Since Moisture2 is READ_WRITE variable, onMoisture2Change() is
  executed every time a new value is received from IoT Cloud.
*/
void onMoisture2Change()  {
  // Add your code here to act upon Moisture2 change
  Serial.print("Moisture2=");
  Serial.println(moisture2);
}

/*
  Since Humidity is READ_WRITE variable, onHumidityChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onHumidityChange()  {
  // Add your code here to act upon Humidity change
  Serial.print("Humidity=");
  Serial.println(humidity);
  
  delay(2000);
 
}

What happens when you try to print them ?

nothing happens, only the moisture value is printed

What do you see if you print ">" immediately before the float and "<" immediately after it ? Is there a space between them ?

i solve the problem.
thanks for the help.

Please share the solution so that others may benefit.

If your question was answered to your satisfaction, please mark the thread as solved so that other members do not waste their time opening the thread wanting to help only to find that the problem has been solved.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.