Created
April 22, 2021 15:32
-
-
Save makersenses/a9cd01f6f1aa8dd23413d011b807945c to your computer and use it in GitHub Desktop.
wifi_esp32_SHTC3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Senses_wifi_esp32.h" | |
#include "Adafruit_SHTC3.h" | |
const char *ssid = "your-wifi-network-name"; | |
const char *passw = "your-wifi-password"; | |
const char *userid = "your-senses-user-id"; | |
const char *key = "your-device-key"; | |
String response; | |
float t, h; | |
Senses_wifi_esp32 myiot; | |
Adafruit_SHTC3 shtc3 = Adafruit_SHTC3(); | |
void setup() { | |
Serial.begin(115200); | |
response = myiot.connect(ssid, passw, userid, key); | |
Serial.println(response); | |
if (! shtc3.begin()) { | |
Serial.println("Couldn't find SHTC3"); | |
while (1) delay(1); | |
} | |
Serial.println("Found SHTC3 sensor"); | |
} | |
void loop() { | |
response = ""; | |
sensors_event_t humidity, temp; | |
shtc3.getEvent(&humidity, &temp); | |
t = temp.temperature; | |
h = humidity.relative_humidity; | |
Serial.println("Temperature is " + String(t) + " celcuis"); | |
Serial.println("Humidity is " + String(h) + " %RH"); | |
Serial.println("----------------------------------------"); | |
response = myiot.send(1, t); | |
Serial.println(response); | |
response = myiot.send(2, h); | |
Serial.println(response); | |
delay(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment