Hi all. I want to showing full range of temperature and humidity in blynk. for example showing temp as 28.56 not only showing 28 or showing humidity 56.85% not only showing 56%. if anyone know how to solve please help.
thanks
the code I wrote:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Wire.h>
#include <SI7021.h>
float temp, hum;
bool SI7021_present = true;
#define I2C_SCL 12
#define I2C_SDA 13
SI7021 sensor;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "16feb1e7ad784f77b0d83b26f22a4825";
char ssid[] = "MikroTik Home";
char pass[] = "12345678";
char server[] = "10.5.51.3";
SimpleTimer timer;
void setup()
{
Wire.begin();
sensor.begin(SDA,SCL);
Wire.begin(I2C_SDA, I2C_SCL);
Serial.begin(115200); // See the connection status in Serial Monitor
Blynk.begin(auth, ssid, pass, server, 8080); //insert here your SSID and password
timer.setInterval(1000L,sendUptime);
}
void sendUptime()
{
int temperature = sensor.getCelsiusHundredths()/100;
int humidity = sensor.getHumidityPercent();
Blynk.virtualWrite(5, temperature); // virtual pin
Blynk.virtualWrite(6, humidity); // virtual pin
}
void loop()
{
Blynk.run();
timer.run();
}
Well, you’re using integer variable types for your temp and humidity. So there will never be any decimal places. If you change to float variables and ensure that your widget is configured to display the desired decimal resolution then it should work correctly.