BME280 sensor, shortening output

Hi all.

So finally got my BME280 working well, its outputting humidity and temperature values, but I want to remove the point answers.

So rather than 28.3 C its just 28 C and 79.7% Humidity to 79% Humidity.

Any quick way to do it would be grand.

Cheers in advance.

Alan

#include "Seeed_BME280.h"
#include <Wire.h>

BME280 bme280;

void setup()
{
  Serial.begin(9600);
  if(!bme280.init()){
    Serial.println("Device error!");
  }
}

void loop()
{
  float pressure;
  
  //get and print temperatures
  Serial.print("Temp: ");
  Serial.print(bme280.getTemperature());
  Serial.println("C");
  
  //get and print atmospheric pressure data
  Serial.print("Pressure: ");
  Serial.print(pressure = bme280.getPressure());
  Serial.println("Pa");

  //get and print altitude data
  Serial.print("Altitude: ");
  Serial.print(bme280.calcAltitude(pressure));
  Serial.println("m");

  //get and print humidity data
  Serial.print("Humidity: ");
  Serial.print(bme280.getHumidity());
  Serial.println("%");

  delay(1000);
}

When printing floats you can specify the number of digits after the decimal with,

Serial.print(someFloat, decimal_places);

For instance, to print temperature with no decimals:

Serial.print(bme280.getTemperature(), 0);

Hi Fungus, great name by the way

I`m actually using the BME280 in conjunction with a Nextion display, tried what you suggested but it did not work and it through up an error.

However you gave me the idea to have a play and this worked!.

Serial.print("t7.txt=");
  Serial.print("\"");
  Serial.print(h, 0);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);

So cheers you helped greatly

Alan