-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Description
Please fill the info fields, it helps to get you faster support ;)
If you have a Guru Meditation Error, please decode it:
https://github.com/me-no-dev/EspExceptionDecoder
----------------------------- Remove above -----------------------------
Hardware:
Board: ?ESP32 Dev Module?
Core Installation/update date: ?11/jul/2017?
IDE name: ?Arduino IDE? ?Platform.io? ?IDF component?
Flash Frequency: ?40Mhz?
Upload Speed: ?115200?
Description:
I can not set hostname use WiFi.setHostname("node1");
Sketch:
/*
* main.cpp
*
* Created on: 2017年11月3日
* Author: I am xxx
*/
#include <arduino.h>
#include <WiFi.h>
#include <PubSubClient.h>
const char* ssid = "PDCN_yalong";
const char* password = "lala123456789";
const char* mqttServer = "192.168.100.217";
const int mqttPort = 1883;
const char* mqttUser = "yourMQTTuser";
const char* mqttPassword = "yourMQTTpassword";
WiFiClient espClient;
PubSubClient client(espClient);
void setup() {
Serial.begin(115200);
WiFi.setHostname("node1");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
client.setServer(mqttServer, mqttPort);
while (!client.connected()) {
Serial.println("Connecting to MQTT...");
if (client.connect("ESP32Client" )) {
Serial.println("connected");
} else {
Serial.print("failed with state ");
Serial.print(client.state());
delay(2000);
}
}
client.publish("esp/test", "Hello from ESP32");
}
void loop() {
client.publish("/home/lala", "3.33");
client.loop();
delay(5000);
//Serial.available()
}
Debug Messages:
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:10212
entry 0x40078a00
E (20) tcpip_adapter: tcpip_adapter is not initialized!
abort() was called at PC 0x40113f33 on core 1
Backtrace: 0x40087b30:0x3ffd56a0 0x40087c2f:0x3ffd56c0 0x40113f33:0x3ffd56e0 0x400d1f35:0x3ffd5720 0x400d138f:0x3ffd5740 0x4011afab:0x3ffd5760
Rebooting...
Metadata
Metadata
Assignees
Labels
No labels