#include "BluetoothSerial.h" #include String device_name = "ESP32-DHT-VasePrijmeni"; BluetoothSerial SerialBT; DHT11 dht11(5); void setup() { Serial.begin(115200); SerialBT.begin(device_name); //SerialBT.deleteAllBondedDevices(); Serial.printf("Zarizeni \"%s\" je zapnuto. \n Bluetooth se brzy zobrazí",device_name.c_str()); } void loop() { int teplota = 0; int vlhkost = 0; int result = dht11.readTemperatureHumidity(teplota, vlhkost); String senzorData; if (result == 0) { senzorData = "Teplota: " + String(teplota) + "°C, Vlhkost: " + String(vlhkost) + "%"; } else { senzorData = "Chyba pri cteni DHT11: " + String(DHT11::getErrorString(result)); } Serial.println(senzorData); SerialBT.println(senzorData); delay(2000); }