Added python debugger and added hw1 enviroment
This commit is contained in:
+8
-2
@@ -38,7 +38,7 @@ ConsolControl consolControl;
|
||||
IPAddress local_IP(WLAN_IP);
|
||||
IPAddress gateway(WLAN_GATEWAY);
|
||||
IPAddress subnet(WLAN_SUBNETMASK);
|
||||
IPAddress mqtt_server(MQTT_SERVER);
|
||||
// IPAddress mqtt_server(MQTT_SERVER);
|
||||
|
||||
WiFiClient wifi_client;
|
||||
PubSubClient mqtt_client(wifi_client);
|
||||
@@ -71,7 +71,8 @@ void setup() {
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
mqtt_client.setServer(mqtt_server, MQTT_PORT);
|
||||
// mqtt_client.setServer(mqtt_server, MQTT_PORT);
|
||||
mqtt_client.setServer(MQTT_SERVER, MQTT_PORT);
|
||||
reconnectMqtt();
|
||||
|
||||
configTime(3600, 3600, "192.168.1.2");
|
||||
@@ -144,7 +145,12 @@ void reconnectMqtt() {
|
||||
String clientId = "ESP32Rover-";
|
||||
clientId += String(random(0xffff), HEX);
|
||||
// Attempt to connect
|
||||
#ifdef MQTT_AUTH
|
||||
if (mqtt_client.connect(clientId.c_str(), MQTT_USER, MQTT_PASSWORD)) {
|
||||
#endif //MQTT_AUTH
|
||||
#ifndef MQTT_AUTH
|
||||
if (mqtt_client.connect(clientId.c_str())) {
|
||||
#endif //MQTT_AUTH
|
||||
Serial.println("connected");
|
||||
// Once connected, publish an announcement...
|
||||
mqtt_client.publish("Rover/Info", "Connected to Mqtt-Broker");
|
||||
|
||||
Reference in New Issue
Block a user