-
-
Save hatsunea/77e35339bd2b7b120ed670a8061c072b to your computer and use it in GitHub Desktop.
This file contains 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
void loop() { | |
if (hasWifi && hasIoTHub) | |
{ | |
if (messageSending && | |
(int)(millis() - send_interval_ms) >= INTERVAL) | |
{ | |
// Send teperature data | |
char messagePayload[MESSAGE_MAX_LEN]; | |
Pressure = Bmp.readPressure() / 100; | |
if(Sht30.get()==0) { | |
Tmp = Sht30.cTemp; | |
Hum = Sht30.humidity; | |
} | |
snprintf(messagePayload, MESSAGE_MAX_LEN, messageData, messageCount++, Tmp, Hum, Pressure); | |
Serial.println(messagePayload); | |
EVENT_INSTANCE* message = Esp32MQTTClient_Event_Generate(messagePayload, MESSAGE); | |
Esp32MQTTClient_SendEventInstance(message); | |
send_interval_ms = millis(); | |
} | |
else | |
{ | |
Esp32MQTTClient_Check(); | |
} | |
} | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment