From 9c825f54e403f7b6993516c702ee8b7a10d9f4b5 Mon Sep 17 00:00:00 2001 From: Tinyu Date: Sat, 18 Sep 2021 21:48:34 +0800 Subject: [PATCH 1/4] fix some error --- examples/Advanced/I2C_Tester/I2C_Tester.ino | 2 +- examples/Advanced/MultSerial/MultSerial.ino | 2 +- examples/Basics/HelloWorld/HelloWorld.ino | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Advanced/I2C_Tester/I2C_Tester.ino b/examples/Advanced/I2C_Tester/I2C_Tester.ino index 89abd3b..0675c51 100644 --- a/examples/Advanced/I2C_Tester/I2C_Tester.ino +++ b/examples/Advanced/I2C_Tester/I2C_Tester.ino @@ -22,7 +22,7 @@ void setup() Wire.begin(); //Init wire and join the I2C network. 初始化wire,并且加入到I2C网络 //Wire.begin(21, 22); //Detect internal I2C, if this sentence is not added, it will detect external I2C. 检测内部I2C,若不加此句为检测外部I2C M5.Lcd.setTextColor(YELLOW); //Set the font color to yellow. 设置字体颜色为黄色 - M5.Lcd.getTextDatum(3); //Rotate the screen. 旋转屏幕 + M5.Lcd.setRotation(3); //Rotate the screen. 旋转屏幕 M5.Lcd.println("M5StickC I2C Tester"); //Print a string on the screen. 在屏幕上打印字符串 delay(3000); diff --git a/examples/Advanced/MultSerial/MultSerial.ino b/examples/Advanced/MultSerial/MultSerial.ino index 6db2271..9b233cf 100644 --- a/examples/Advanced/MultSerial/MultSerial.ino +++ b/examples/Advanced/MultSerial/MultSerial.ino @@ -15,7 +15,7 @@ void setup() { M5.begin(); //Init M5StickC. 初始化 M5StickC // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert) - Serial2.begin(115200, SERIAL_8N1, 16, 17); //Init serial port 2. 初始化串口2 + Serial2.begin(115200, SERIAL_8N1, 33, 32); //Init serial port 2. 初始化串口2 } void loop() { diff --git a/examples/Basics/HelloWorld/HelloWorld.ino b/examples/Basics/HelloWorld/HelloWorld.ino index ff81a57..4f2f3ac 100644 --- a/examples/Basics/HelloWorld/HelloWorld.ino +++ b/examples/Basics/HelloWorld/HelloWorld.ino @@ -6,7 +6,7 @@ * Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc * 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc * -* describe: Display. +* describe: Hello World. * date:2021/9/3 ******************************************************************************* */ From 02f086a008a133864775e9aef79ec6c7b0664aee Mon Sep 17 00:00:00 2001 From: Tinyu Date: Tue, 28 Sep 2021 13:31:17 +0800 Subject: [PATCH 2/4] delect some keyboard --- examples/Basics/FactoryTest/FactoryTest.ino | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/Basics/FactoryTest/FactoryTest.ino b/examples/Basics/FactoryTest/FactoryTest.ino index b852c81..2bf8cf9 100644 --- a/examples/Basics/FactoryTest/FactoryTest.ino +++ b/examples/Basics/FactoryTest/FactoryTest.ino @@ -1356,7 +1356,6 @@ void setup() Displaybuff(); delay(30); } - //Serial.printf(" STC\r\n"); if (InitI2SMicroPhone() != true) { ErrorMeg(0x51, "MicroPhone error",0 ,true); From 1ef25bbb5271d69aa8d4c9d633c830b127d68413 Mon Sep 17 00:00:00 2001 From: Tinyu Date: Sat, 23 Oct 2021 22:24:39 +0800 Subject: [PATCH 3/4] Ezdata --- README_cn.md | 2 +- examples/Advanced/EzData/EzData.ino | 88 +++++++++++++++++++++++++++++ library.properties | 2 +- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 examples/Advanced/EzData/EzData.ino diff --git a/README_cn.md b/README_cn.md index 909237a..3cc9916 100644 --- a/README_cn.md +++ b/README_cn.md @@ -22,7 +22,7 @@ **Arduino IDE 环境搭建**: [点击这里](https://docs.m5stack.com/zh_CN/arduino/arduino_development) -**M5StickC Arduino API**: [点击这里](https://docs.m5stack.com/en/api/stickc/system_m5stickc) +**M5StickC Arduino API**: [点击这里](https://docs.m5stack.com/zh_CN/api/stickc/system_m5stickc) **引脚地图**: [点击这里](https://docs.m5stack.com/zh_CN/core/m5stickc) diff --git a/examples/Advanced/EzData/EzData.ino b/examples/Advanced/EzData/EzData.ino new file mode 100644 index 0000000..f1a9ff2 --- /dev/null +++ b/examples/Advanced/EzData/EzData.ino @@ -0,0 +1,88 @@ +/* +******************************************************************************* +* Copyright (c) 2021 by M5Stack +* Equipped with M5StickC sample source code +* 配套 M5StickC 示例源代码 +* Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc +* 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc +* +* describe:EzData. +* date:2021/10/23 +******************************************************************************* +*/ +#include "M5StickC.h" +#include "M5_EzData.h" + +// Configure the name and password of the connected wifi and your token. 配置所连接wifi的名称、密码以及你的token +const char* ssid = "Explore-F"; +const char* password = "xingchentansuo123"; +const char* token = "xaOdLXdUciNUXQ9DsGQRwE5gyIsFLCnI"; + +void setup() { + M5.begin(); //Initialize M5Stack + M5.Lcd.setRotation(3); + if(setupWifi(ssid,password)){ //Connect to wifi. 连接到wifi + M5.Lcd.printf("Success connecting to %s\n",ssid); + }else{ + M5.Lcd.printf("Connecting to %s failed\n",ssid); + } +} + +void loop() { + //Save the data 20 to the top of the testData topic queue. 保存数据20至 testData 队列首位 + if(setData(token,"testData",20)){ + M5.Lcd.printf("Success sending data to the topic\n"); + }else{ + M5.Lcd.print("Fail to save data\n"); + } + delay(5000); + + //Save 3 data in sequence to the first place of testList. 依次保存3个数据至 testList首位 + for(int i=0;i<3;i++){ + if(addToList(token,"testList",i)){ + M5.Lcd.printf("Success sending %d to the list\n",i); + }else{ + M5.Lcd.print("Fail to save data\n"); + } + delay(100); + } + delay(5000); + M5.Lcd.fillScreen(BLACK); + M5.Lcd.setCursor(0,0); + + //Get a piece of data from a topic and store the value in result. 从一个 topic中获取一个数据,并将值存储在 result + int result=0; + if(getData(token,"testData",result)){ + M5.Lcd.printf("Success get data %d\n",result); + }else{ + M5.Lcd.print("Fail to get data\n"); + } + delay(5000); + +//Get a set of data from a list and store the values in the Array array. 从一个 list中获取一组数据,并将值存储在 Array数组中 + int Array[3]={}; + if(getData(token,"testList",Array,0,3)){ + M5.Lcd.print("Success get list\n"); + for(int i=0;i<3;i++){ + M5.Lcd.printf("Array[%d]=%d,",i,Array[i]); + } + M5.Lcd.println(""); + }else{ + M5.Lcd.println("Fail to get data"); + } + delay(5000); + + //Remove data + if(removeData(token,"testData")) + M5.Lcd.printf("Success remove data\n"); + else + M5.Lcd.println("Fail to remove data"); + + if(removeData(token,"testList")) + M5.Lcd.printf("Success remove data from the list\n"); + else + M5.Lcd.println("Fail to remove data"); + delay(5000); + M5.Lcd.fillScreen(BLACK); + M5.Lcd.setCursor(0,0); +} \ No newline at end of file diff --git a/library.properties b/library.properties index aed2e82..8b8d5ae 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Device Control url=https://github.com/m5stack/M5StickC.git architectures=esp32 includes=M5StickC.h -depends=UNIT_ENV,Adafruit MCP4725,Adafruit TCS34725,Adafruit NeoPixel,MAX30100lib,FastLED,MFRC522_I2C,M5GFX,M5_BM8563,M5_ADS1100,M5_ADS1115,M5_FPC1020A,HX711 Arduino Library,PCA9554,TinyGPSPlus,Adafruit SGP30 Sensor,FFT,TFTTerminal,ClosedCube TCA9548A,M5GFX +depends=UNIT_ENV,Adafruit MCP4725,Adafruit TCS34725,Adafruit NeoPixel,MAX30100lib,FastLED,MFRC522_I2C,M5GFX,M5_BM8563,M5_ADS1100,M5_ADS1115,M5_FPC1020A,HX711 Arduino Library,PCA9554,TinyGPSPlus,Adafruit SGP30 Sensor,FFT,TFTTerminal,ClosedCube TCA9548A,M5GFX,M5_EzData,ArduinoJson From 08bfd56e91c2bc9664642ff9f969d070ac565d79 Mon Sep 17 00:00:00 2001 From: Tinyu Date: Sat, 23 Oct 2021 22:26:12 +0800 Subject: [PATCH 4/4] ezdata --- examples/Advanced/EzData/EzData.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Advanced/EzData/EzData.ino b/examples/Advanced/EzData/EzData.ino index f1a9ff2..b821b1a 100644 --- a/examples/Advanced/EzData/EzData.ino +++ b/examples/Advanced/EzData/EzData.ino @@ -16,7 +16,7 @@ // Configure the name and password of the connected wifi and your token. 配置所连接wifi的名称、密码以及你的token const char* ssid = "Explore-F"; const char* password = "xingchentansuo123"; -const char* token = "xaOdLXdUciNUXQ9DsGQRwE5gyIsFLCnI"; +const char* token = ""; void setup() { M5.begin(); //Initialize M5Stack