debug start
This commit is contained in:
parent
c1d598ab20
commit
fc907e0c7a
7 changed files with 194 additions and 4 deletions
36
Template Project/src/iot_framdemo.cpp
Normal file
36
Template Project/src/iot_framdemo.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <ESPMegaPRO_OOP.hpp>
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
|
||||
void setup() {
|
||||
espmega.begin();
|
||||
espmega.enableIotModule();
|
||||
NetworkConfig config = {
|
||||
.ip = {192, 168, 0, 11},
|
||||
.gateway = {192, 168, 0, 1},
|
||||
.subnet = {255, 255, 255, 0},
|
||||
.dns1 = {192, 168, 0, 1},
|
||||
.dns2 = {192, 168, 0, 1},
|
||||
.useStaticIp = true,
|
||||
.useWifi = false,
|
||||
.wifiUseAuth = false,
|
||||
};
|
||||
strcpy(config.ssid, "ssid");
|
||||
strcpy(config.password, "password");
|
||||
strcpy(config.hostname, "espmega");
|
||||
espmega.iot.setNetworkConfig(config);
|
||||
espmega.iot.connectNetwork();
|
||||
MqttConfig mqtt_config = {
|
||||
.mqtt_port = 1883,
|
||||
.mqtt_useauth = false
|
||||
};
|
||||
strcpy(mqtt_config.mqtt_server, "192.168.0.26");
|
||||
espmega.iot.setMqttConfig(mqtt_config);
|
||||
espmega.iot.connectToMqtt();
|
||||
espmega.iot.registerCard(0);
|
||||
espmega.iot.registerCard(1);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
espmega.loop();
|
||||
}
|
|
@ -29,7 +29,6 @@ void setup()
|
|||
espmega.iot.registerMqttCallback(mqtt_callback);
|
||||
espmega.iot.registerCard(1);
|
||||
espmega.iot.publishCard(1);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue