mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add nb-iot and lte
This commit is contained in:
+1
-46
@@ -95,53 +95,8 @@ Product Feature:
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*To get complete code, please click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LTE/Arduino).*
|
||||
*To get complete code, please click [here](https://github.com/m5stack/M5Stack/blob/master/examples/Modules/LTE/LTE.ino).*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void IotWriteCommand(char cmd[],char date[]){
|
||||
char buf[256] = {0};
|
||||
|
||||
if(cmd == NULL)
|
||||
sprintf(buf,"AT\r\n");
|
||||
else if(date == NULL)
|
||||
sprintf(buf,"AT+%s\r\n",cmd);
|
||||
else
|
||||
sprintf(buf,"AT+%s=%s\r\n",cmd,date);
|
||||
|
||||
Serial2.write(buf);
|
||||
}
|
||||
|
||||
void get_time(void){
|
||||
IotWriteCommand(NULL,NULL);
|
||||
while(Serial2.available()){
|
||||
uint8_t ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
M5.Lcd.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial2.begin(115200, SERIAL_8N1, 16, 17);
|
||||
pinMode(2, OUTPUT);
|
||||
digitalWrite(2, 0);
|
||||
delay(3000);
|
||||
digitalWrite(2, 1);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(M5.BtnA.wasReleased()){
|
||||
M5.Lcd.fillScreen(TFT_BLACK);
|
||||
M5.Lcd.setCursor(60,80,2);
|
||||
get_time();
|
||||
}
|
||||
M5.update();
|
||||
}
|
||||
```
|
||||
|
||||
### Pin Map
|
||||
|
||||
|
||||
@@ -123,55 +123,7 @@ only for reference
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*To get complete code, please click [here](https://github.com/m5stack/M5-ProductExampleCodes/blob/master/Module/NB_IOT/Arduino/NB_IOT.ino).*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void IotWriteCommand(char cmd[],char date[]){
|
||||
char buf[256] = {0};
|
||||
|
||||
if(cmd == NULL)
|
||||
sprintf(buf,"AT\r\n");
|
||||
else if(date == NULL)
|
||||
sprintf(buf,"AT+%s\r\n",cmd);
|
||||
else
|
||||
sprintf(buf,"AT+%s=%s\r\n",cmd,date);
|
||||
|
||||
Serial2.write(buf);
|
||||
}
|
||||
|
||||
void get_time(void){
|
||||
IotWriteCommand("CCLK?",NULL);
|
||||
while(Serial2.available()){
|
||||
uint8_t ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
M5.Lcd.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial2.begin(115200, SERIAL_8N1, 16, 17);
|
||||
pinMode(2, OUTPUT);
|
||||
digitalWrite(2, 0);
|
||||
delay(3000);
|
||||
digitalWrite(2, 1);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
if(M5.BtnA.wasReleased()){
|
||||
M5.Lcd.fillScreen(TFT_BLACK);
|
||||
M5.Lcd.setCursor(60,80,2);
|
||||
get_time();
|
||||
}
|
||||
M5.update();
|
||||
}
|
||||
|
||||
```
|
||||
*To get complete code, please click [here]().*
|
||||
|
||||
### Pin Map
|
||||
|
||||
|
||||
@@ -93,54 +93,7 @@
|
||||
|
||||
### Arduino IDE
|
||||
|
||||
*以下代码仅为片段,如需获取完整代码, [请点击此处.](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LTE/Arduino).*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void IotWriteCommand(char cmd[],char date[]){
|
||||
char buf[256] = {0};
|
||||
|
||||
if(cmd == NULL)
|
||||
sprintf(buf,"AT\r\n");
|
||||
else if(date == NULL)
|
||||
sprintf(buf,"AT+%s\r\n",cmd);
|
||||
else
|
||||
sprintf(buf,"AT+%s=%s\r\n",cmd,date);
|
||||
|
||||
Serial2.write(buf);
|
||||
}
|
||||
|
||||
void get_time(void){
|
||||
IotWriteCommand(NULL,NULL);
|
||||
while(Serial2.available()){
|
||||
uint8_t ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
M5.Lcd.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial2.begin(115200, SERIAL_8N1, 16, 17);
|
||||
pinMode(2, OUTPUT);
|
||||
digitalWrite(2, 0);
|
||||
delay(3000);
|
||||
digitalWrite(2, 1);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(M5.BtnA.wasReleased()){
|
||||
M5.Lcd.fillScreen(TFT_BLACK);
|
||||
M5.Lcd.setCursor(60,80,2);
|
||||
get_time();
|
||||
}
|
||||
M5.update();
|
||||
}
|
||||
```
|
||||
|
||||
*以下代码仅为片段,如需获取完整代码, [请点击此处.](https://github.com/m5stack/M5Stack/blob/master/examples/Modules/LTE/LTE.ino).*
|
||||
|
||||
### 管脚映射
|
||||
|
||||
|
||||
@@ -126,55 +126,7 @@ Middle East and North Africa: B8(900) and B20(800); -->
|
||||
|
||||
### Arduino IDE
|
||||
|
||||
*以下代码仅为片段,如需获取完整代码, [请点击此处.](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/NB_IOT/Arduino).*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void IotWriteCommand(char cmd[],char date[]){
|
||||
char buf[256] = {0};
|
||||
|
||||
if(cmd == NULL)
|
||||
sprintf(buf,"AT\r\n");
|
||||
else if(date == NULL)
|
||||
sprintf(buf,"AT+%s\r\n",cmd);
|
||||
else
|
||||
sprintf(buf,"AT+%s=%s\r\n",cmd,date);
|
||||
|
||||
Serial2.write(buf);
|
||||
}
|
||||
|
||||
void get_time(void){
|
||||
IotWriteCommand("CCLK?",NULL);
|
||||
while(Serial2.available()){
|
||||
uint8_t ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
M5.Lcd.write(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial2.begin(115200, SERIAL_8N1, 16, 17);
|
||||
pinMode(2, OUTPUT);
|
||||
digitalWrite(2, 0);
|
||||
delay(3000);
|
||||
digitalWrite(2, 1);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
if(M5.BtnA.wasReleased()){
|
||||
M5.Lcd.fillScreen(TFT_BLACK);
|
||||
M5.Lcd.setCursor(60,80,2);
|
||||
get_time();
|
||||
}
|
||||
M5.update();
|
||||
}
|
||||
```
|
||||
|
||||
*以下代码仅为片段,如需获取完整代码, [请点击此处.]().*
|
||||
|
||||
### 管脚映射
|
||||
|
||||
|
||||
Reference in New Issue
Block a user