When I try to use the library in an ESP32 the mere act of declaring the MQTTClient makes the wifi connection fail. For instance (in the code below), if I comment out the line
MQTTClient client = MQTTClient(256), the wireless connection works just fine.
If not, it gets caught in an endless loop of trying to connect to the network. Just including the library on the ESP32 causes wireless connection to fail. I am using the Arduino IDE
include
include "secrets.h"
include
include
include
WiFiClientSecure net = WiFiClientSecure();
//device cannot connect to wifi because of the following line of code.
MQTTClient client = MQTTClient(256);
When I try to use the library in an ESP32 the mere act of declaring the MQTTClient makes the wifi connection fail. For instance (in the code below), if I comment out the line MQTTClient client = MQTTClient(256), the wireless connection works just fine. If not, it gets caught in an endless loop of trying to connect to the network. Just including the library on the ESP32 causes wireless connection to fail. I am using the Arduino IDE
include
include "secrets.h"
include
include
include
WiFiClientSecure net = WiFiClientSecure(); //device cannot connect to wifi because of the following line of code. MQTTClient client = MQTTClient(256);
const char WIFI_SSID = "xxxxx"; const char WIFI_PASSWORD = "xxxxx";
void connectAWS() { WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.println(WIFI_SSID);
while (WiFi.status() != WL_CONNECTED){ delay(500); Serial.println("Connecting to wifi"); }
Serial.println("Connected"); }
// the setup function runs once when you press reset or power the board void setup() { Serial.begin(9600); Serial.print("setting up"); connectAWS(); }
// the loop function runs over and over again forever void loop() {
}
//Not connecting
//Connected