How to I get rid of decimals? I have an IoT project with Blynk that has 3 decimal places. I want humidity and pressure to have no decimals and temperature to have 1. Here is the code:
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
Adafruit_BME280 bme2;
char auth[] = "wi5JL7Smxw7x6t7kLXkYipbQWU-Ww1PA";
char ssid[] = "WIN_700966";
char pass[] = "tgdxh4p65q";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
bme.begin(0x76);
bme2.begin(0x77);
Blynk.begin(auth, ssid, pass);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
Blynk.virtualWrite(V2, bme.readTemperature() * 9 / 5 + 32);
Blynk.virtualWrite(V3, bme.readHumidity());
Blynk.virtualWrite(V4, bme.readPressure() / 100.0F);
Blynk.virtualWrite(V0, bme2.readTemperature() * 9 / 5 + 32);
Blynk.virtualWrite(V1, bme2.readHumidity());
}