BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk and Arduino uno ethernet shield with I2C sensor

Hi friends. I write a sketch to showing the SHT20 temp and humidity but the sensor can not communicating with the Blynk. the sensor worked with arduino code but not working with blynk.
the scl and sda of sensor is connected to the ethernet shield A4 and A5

here the sketch:

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <Wire.h>
#include "DFRobot_SHT20.h"

char auth[] = "5H1Dt2Sss3WIYqC2hUfj68Ya3nJzxCeN";
char server[] = "10.5.51.7";

#define W5100_CS  10

BlynkTimer timer;

DFRobot_SHT20    sht20;

void setup()
{
  Blynk.begin(auth, server, 8080);
  sht20.initSHT20();
  delay(100);
  sht20.checkSHT20();
  timer.setInterval(2000L, TH);
}

void TH()
{
  float humd = sht20.readHumidity();
  Blynk.virtualWrite(V1, (float)humd);

  float temp = sht20.readTemperature();
  Blynk.virtualWrite(V2, temp);
}

void loop()
{
  Blynk.run();
}

ahhh sh***t I forget add the timer.run(); in loop :slight_smile:

image

1 Like

:sweat_smile::sweat_smile::sweat_smile:

1 Like