ESP32 Starter Kit
3. Wiring Diagram
4. Test Code
Add libraries to Arduino IDE first.
/*
keyestudio ESP32 Inventor Learning Kit
Project 23.1 Smart Cup
http://www.keyestudio.com
*/
#include <xht11.h>
xht11 xht(26); //The DHT11 sensor connects to IO26
unsigned char dat[] = {0,0,0,0}; //Define an array to store temperature and humidity data
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (xht.receive(dat)) { //Check correct return to true
(continues on next page)
8.5. Arduino Project 129