installed libraries and changed code to ESP32

-> working
This commit is contained in:
Joe Tretter
2020-09-24 12:26:22 -05:00
parent b0159ea45e
commit 0141f2ef36
3 changed files with 31 additions and 16 deletions

View File

@@ -1,14 +1,20 @@
; PlatformIO Project Configuration File ; PlatformIO Project Configuration File
; ;
; Build options: build flags, source filter ; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags ; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages ; Library options: dependencies, extra library storages
; Advanced options: extra scripting ; Advanced options: extra scripting
; ;
; Please visit documentation for the other options and examples ; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[env:esp32doit-devkit-v1] [env:esp32doit-devkit-v1]
platform = espressif32 platform = espressif32
board = esp32doit-devkit-v1 board = esp32doit-devkit-v1
framework = arduino framework = arduino
lib_deps =
khoih-prog/ESP_WiFiManager@^1.1.2
monstrenyatko/ArduinoMqtt@^1.5.1
beegee-tokyo/DHT sensor library for ESPx@^1.17
bblanchon/ArduinoJson@^6.16.1
knolleary/PubSubClient@^2.8

View File

@@ -19,7 +19,7 @@
*/ */
#include <Arduino.h> #include <Arduino.h>
#include <ESP8266WiFi.h> #include <WiFi.h>
#include <PubSubClient.h> #include <PubSubClient.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "DHTesp.h" #include "DHTesp.h"
@@ -68,7 +68,7 @@ void reconnect() {
while (!client.connected()) { while (!client.connected()) {
Serial.print("Attempting MQTT connection..."); Serial.print("Attempting MQTT connection...");
// Create a random client ID // Create a random client ID
String clientId = "ESP8266Client-"; String clientId = "ESP32Client-";
clientId += String(random(0xffff), HEX); clientId += String(random(0xffff), HEX);
// Attempt to connect // Attempt to connect
if (client.connect(clientId.c_str())) { if (client.connect(clientId.c_str())) {

View File

@@ -0,0 +1,9 @@
{
"folders": [
{
"name": "TempMQTT",
"path": ".."
}
],
"settings": {}
}