-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修改README
- Loading branch information
Showing
1 changed file
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
# EC20x_lib | ||
# IOLTE_Lib | ||
|
||
## 简介 | ||
|
||
支持MQTT和HTTP协议操作 | ||
理论上支持所有带串口模块进行AT指令操作,但需要逐步完善 | ||
|
||
## 使用示例 | ||
|
||
```c | ||
EC20xlib M4G(Serial2); | ||
··· | ||
··· | ||
void setup() { | ||
//EC20串口初始化 | ||
Serial2.begin(115200); | ||
//4G模块电源 | ||
M4G.powerOn(M4G_POWKEY); | ||
//订阅回调 | ||
M4G.attachsubcallback(subdatacallback); | ||
//模块连接状态回调 | ||
M4G.attacheventcallback(eventcallback); | ||
logi("Init 4G"); | ||
uint8_t restatus = 0; | ||
//模块初始化 | ||
restatus = M4G.begin(); | ||
if(restatus == 0) logi("Init 4G module -- OK"); | ||
//读取CCID | ||
M4G.Read_CCID(simnum); | ||
logi("CCID:%s",simnum); | ||
//读取IMEI | ||
M4G.Read_IMEI(imei_num); | ||
logi("IMEI:%s",imei_num); | ||
//连接MQTT | ||
M4G.connectMqttServer(mqtt_pubtopic,mqtt_server,mqtt_port,mqtt_user,mqtt_pass,60,1,mqtt_willtopic,"offline"); | ||
//订阅主题 | ||
M4G.SubTopic(mqtt_subtopic,M_QOS); | ||
//发布主题 | ||
M4G.PubTopic(mqtt_willtopic,"online",M_QOS); | ||
} | ||
|
||
``` |