2645 views|2 replies

1w

Posts

25

Resources
The OP
 

Reading SHT3x with ESP8266 [Copy link]

 

The community is carrying out an activity for the SHT31 development board, and I happened to see a post about SHT3x (which should be compatible with SHT31) on the Internet, so I shared it with you.

Original: https://www.hackster.io/BuiHao96/control-led-and-sht3x-via-blynk-0740b9

Control Led and SHT3x via Blynk

The microcontroller program is developed using Arduino

// Robo India Tutorial 
// Digital Output on LED 
// Hardware: NodeMCU Blynk Board


#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
Adafruit_SHT31 sht31 = Adafruit_SHT31();
SimpleTimer timer;
char auth[] = "YourAuthToken";            // You should get Auth Token in the Blynk App.
char ssid[] = "YourNetworkName";    // Your WiFi credentials.
char pass[] = "YourPassword";  // Set password to "" for open networks.
void setup()
{
    Serial.begin(9600);// Debug console
    Blynk.begin(auth, ssid, pass);
      if (! sht31.begin(0x44))
      {   // Set to 0x45 for alternate i2c addr
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
     }
    timer.setInterval(2000, sendUptime);
}
void sendUptime()
{
    float t = sht31.readTemperature();
    float h = sht31.readHumidity();
     //Serial.print("Temp *C = "); Serial.println(t);
     //Serial.print("Hum. % = "); Serial.println(h);
    Blynk.virtualWrite(V0, t);
    Blynk.virtualWrite(V1, h);
}

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

Latest reply

HOW DOES IT PERFORM?   Details Published on 2020-1-1 09:13
 
 

266

Posts

0

Resources
2
 

HOW DOES IT PERFORM?

Comments

I can't try it without a board, so I'll post it for your reference.  Details Published on 2020-1-1 12:26
Personal signature

gitee/casy

 
 
 

1w

Posts

25

Resources
3
 

I can't try it without a board, so I'll post it for your reference.

 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list