-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (27 loc) · 823 Bytes
/
Copy pathmain.cpp
File metadata and controls
36 lines (27 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <cstring>
#include "pico/stdlib.h"
#include "ESP8285.h"
#include "mqtt.h"
int main() {
stdio_init_all();
sleep_ms(2000);
printf("=== ESP8285 WiFi ===\n");
auto& wifi = ESP8285Controller::instance();
wifi.checkATVersion();
wifi.connectWiFi("HUAWEI-4Ncg", "AcVvgU2z");
wifi.checkWiFiConnection();
wifi.getIP();
wifi.checkAPAvailable();
printf("=== ESP8285 MQTT ===\n");
MQTTController mqttConection = MQTTController("0","leaf1");
mqttConection.connect("192.168.1.19", 2001);
mqttConection.subscription2Topic("sensors/", 0);
mqttConection.publish2Topic("3.555","sensors/", 0);
//mqttConection.disconnect();
while (true) {
mqttConection.recievefromTopic("sensors/");
}
}