Float to text [SOLVED]

Hi guys

I`m trying to convert float value to text in order to be displayed correctly in Nextion display.
Nextion is Integer math and does not accept float unless is in text format.

I`m not so sure how the “dtostrf” works.

Can you please help me solving this?

Thanks

void Voltmeter(void)
{
  for (int i = 0; i < SensorSampling; i++) value += analogRead(VoltageInput); // return 0..1023 representing 0..5V
  value = value / SensorSampling;

  // CONVERT TO VOLTAGE
  // float vout = (5.0 * value) / 1023; // voltage = 0..5V;  we do the math in millivolts!!

  pinMode(VoltageInput, INPUT);
  // read the value at analog input
  vout = (value * 5.0) / 1024.0; 
  vin = vout / (R2 / (R1 + R2));
  if (vin < 0.09) {
    vin = 0.0; //statement to quash undesired reading !
  }
  dtostrf(vin, 4, 6, buff);
  Serial.println(vin, 1);
  Serial1.print("t1.text=");
  Serial1.print(vin, 1);
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);


}

mOskit: I`m not so sure how the "dtostrf" works.

Did your read the Reference Page?

What does the code do that is not what you want? How is the buff array declared? It is not shown in your snippet. Snippets often leave out important information.

Sorry guys for lack of info.

So Buffer is set globally

char buff[10];

I just noticed that i didnt declare the values for the Nextion display, NexText t1 = NexText(1, 13, "t1");` and also i was sending the float "vin" rather than the converted value from buffer

  dtostrf(vin, 6, 1, buff);
  t1.setText(buff);
  Serial.println(buff);
  Serial1.print("t1.setText=");
  Serial1.print(buff);
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);

Changing this topic to SOLVED. Thank you