diff --git a/README.md b/README.md index 1fcb9f0..e95a551 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ## Overview -### SKU:U001 & U001-B & U001-C +### SKU:U001 & U001-B & U001-C & U090 -Contains M5Stack-**UNIT ENV** series related case programs.ENV is an environmental sensor with integrated SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data. +Contains M5Stack-**UNIT ENV & BPS** series related case programs. ENV is an environmental sensor with integrated SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data. ## Related Link @@ -16,4 +16,4 @@ Contains M5Stack-**UNIT ENV** series related case programs.ENV is an environment ## License -- [M5Unit-ENV - MIT](LICENSE) +- [M5Unit-ENV - MIT](LICENSE) \ No newline at end of file diff --git a/examples/Unit_BPS_M5Core/Unit_BPS_M5Core.ino b/examples/Unit_BPS_M5Core/Unit_BPS_M5Core.ino new file mode 100644 index 0000000..6dc1fc5 --- /dev/null +++ b/examples/Unit_BPS_M5Core/Unit_BPS_M5Core.ino @@ -0,0 +1,44 @@ +/* +******************************************************************************* +* Copyright (c) 2022 by M5Stack +* Equipped with M5Core sample source code +* 配套 M5Core 示例源代码 +* Visit for more information: https://docs.m5stack.com/en/unit/bps +* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/bps +* +* Product: BPS_BMP280. 气压计 +* Date: 2022/8/18 +******************************************** *********************************** + Please connect to Port A(22、21),Read atmospheric pressure and temperature and + display them on the display screen + 请连接端口A(22、21),读取大气压强和温度并在显示屏上显示 +*/ + +#include +#include + +Adafruit_BMP280 bme; + +void setup() { + M5.begin(); // Init M5Stack. 初始化M5Stack + M5.Power.begin(); // Init power 初始化电源模块 + M5.Lcd.setTextSize(2); //设置字体大小为2. Set the font size to 2 + Wire.begin(); // Wire init, adding the I2C bus. Wire初始化, 加入i2c总线 + while (!bme.begin( + 0x76)) { // Init this sensor,True if the init was successful, otherwise + // false. 初始化传感器,如果初始化成功返回1 + M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!"); + } + M5.Lcd.clear(); // Clear the screen. 清屏 +} + +float pressure, + Temp; // Store the vuale of pressure and Temperature. 存储压力和温度 + +void loop() { + pressure = bme.readPressure(); + Temp = bme.readTemperature(); + M5.Lcd.setCursor(0, 0); //将光标设置在(0 ,0). Set the cursor to (0,0) + M5.Lcd.printf("Pressure:%2.0fPa\nTemperature:%2.0f^C", pressure, Temp); + delay(100); +} diff --git a/examples/Unit_BPS_M5Core2/Unit_BPS_M5Core2.ino b/examples/Unit_BPS_M5Core2/Unit_BPS_M5Core2.ino new file mode 100644 index 0000000..eb59639 --- /dev/null +++ b/examples/Unit_BPS_M5Core2/Unit_BPS_M5Core2.ino @@ -0,0 +1,43 @@ +/* +******************************************************************************* +* Copyright (c) 2022 by M5Stack +* Equipped with M5Core2 sample source code +* 配套 M5Core2 示例源代码 +* Visit for more information: https://docs.m5stack.com/en/unit/bps +* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/bps +* +* Product: BPS_BMP280. 气压计 +* Date: 2022/8/18 +******************************************** *********************************** + Please connect to Port A(22、21),Read atmospheric pressure and temperature and + display them on the display screen + 请连接端口A(22、21),读取大气压强和温度并在显示屏上显示 +*/ + +#include +#include + +Adafruit_BMP280 bme; + +void setup() { + M5.begin(); // Init M5Core2. 初始化 M5Core2 + Wire.begin(); // Wire init, adding the I2C bus. Wire初始化, 加入i2c总线 + while (!bme.begin( + 0x76)) { // Init this sensor,True if the init was successful, otherwise + // false. 初始化传感器,如果初始化成功返回1 + M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!"); + } + M5.Lcd.clear(); // Clear the screen. 清屏 +} + +float pressure, + Temp; // Store the vuale of pressure and Temperature. 存储压力和温度() + +void loop() { + pressure = bme.readPressure(); + Temp = bme.readTemperature(); + M5.Lcd.setCursor(0, 0); //将光标设置在(0 ,0). Set the cursor to (0,0) + M5.Lcd.setTextSize(3); //设置字体大小为3. Set the font size to 3 + M5.Lcd.printf("Pressure:%2.0fPa\nTemperature:%2.0f^C", pressure, Temp); + delay(100); +} diff --git a/examples/Unit_BPS_M5StickC/Unit_BPS_M5StickC.ino b/examples/Unit_BPS_M5StickC/Unit_BPS_M5StickC.ino new file mode 100644 index 0000000..258f115 --- /dev/null +++ b/examples/Unit_BPS_M5StickC/Unit_BPS_M5StickC.ino @@ -0,0 +1,42 @@ +/* +******************************************************************************* +* Copyright (c) 2021 by M5Stack +* Equipped with M5StickC sample source code +* 配套 M5StickC 示例源代码 +* Visit for more information: https://docs.m5stack.com/en/unit/bps +* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/bps +* +* Product: BPS_BMP280. 气压计 +* Date: 2022/8/18 +******************************************** *********************************** + Please connect to Port,Read atmospheric pressure and temperature and display + them on the display screen 请连接端口,读取大气压强和温度并在显示屏上显示 +*/ +#include +#include + +Adafruit_BMP280 bme; + +void setup() { + M5.begin(); // Init M5StickC. 初始化 M5StickC + M5.Lcd.setRotation(3); // Rotate the screen. 旋转屏幕 + Wire.begin(); // Wire init, adding the I2C bus. Wire初始化, 加入i2c总线 + while (!bme.begin( + 0x76)) { // Init this sensor,True if the init was successful, otherwise + // false. 初始化传感器,如果初始化成功返回1 + M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!"); + } + M5.Lcd.fillScreen(BLACK); // Clear the screen. 清屏 +} + +float pressure, + Temp; // Store the vuale of pressure and Temperature. 存储压力和温度() + +void loop() { + pressure = bme.readPressure(); + Temp = bme.readTemperature(); + M5.Lcd.setCursor(0, 0); //将光标设置在(0 ,0). Set the cursor to (0,0) + M5.Lcd.setTextSize(2); //设置字体大小为2. Set the font size to 2 + M5.Lcd.printf("Pre:%2.0fPa\nTem:%2.0f^C", pressure, Temp); + delay(100); +} diff --git a/examples/Unit_BPS_M5StickCPlus/Unit_BPS_M5StickCPlus.ino b/examples/Unit_BPS_M5StickCPlus/Unit_BPS_M5StickCPlus.ino new file mode 100644 index 0000000..4e77283 --- /dev/null +++ b/examples/Unit_BPS_M5StickCPlus/Unit_BPS_M5StickCPlus.ino @@ -0,0 +1,42 @@ +/* +******************************************************************************* +* Copyright (c) 2021 by M5Stack +* Equipped with M5StickCPlus sample source code +* 配套 M5StickCPlus 示例源代码 +* Visit for more information: https://docs.m5stack.com/en/unit/bps +* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/unit/bps +* +* Product: BPS_BMP280. 气压计 +* Date: 2022/8/18 +******************************************** *********************************** + Please connect to Port,Read atmospheric pressure and temperature and display + them on the display screen 请连接端口,读取大气压强和温度并在显示屏上显示 +*/ +#include +#include + +Adafruit_BMP280 bme; + +void setup() { + M5.begin(); // Init M5StickCPlus. 初始化 M5StickCPlus + M5.Lcd.setRotation(3); // Rotate the screen. 旋转屏幕 + Wire.begin(); // Wire init, adding the I2C bus. Wire初始化, 加入i2c总线 + while (!bme.begin( + 0x76)) { // Init this sensor,True if the init was successful, otherwise + // false. 初始化传感器,如果初始化成功返回1 + M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!"); + } + M5.Lcd.fillScreen(BLACK); // Clear the screen. 清屏 +} + +float pressure, + Temp; // Store the vuale of pressure and Temperature. 存储压力和温度() + +void loop() { + pressure = bme.readPressure(); + Temp = bme.readTemperature(); + M5.Lcd.setCursor(0, 0); //将光标设置在(0 ,0). Set the cursor to (0,0) + M5.Lcd.setTextSize(2); //设置字体大小为2. Set the font size to 2 + M5.Lcd.printf("Pre:%2.0fPa\nTem:%2.0f^C", pressure, Temp); + delay(100); +} diff --git a/library.json b/library.json index 63e8b5f..aeeb6ca 100644 --- a/library.json +++ b/library.json @@ -10,7 +10,7 @@ "type": "git", "url": "https://github.com/m5stack/M5Unit-ENV.git" }, - "version": "0.0.5", + "version": "0.0.6", "frameworks": "arduino", "platforms": "espressif32" } \ No newline at end of file diff --git a/library.properties b/library.properties index 3657340..8b9fadf 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=M5Unit-ENV -version=0.0.5 +version=0.0.6 author=M5Stack maintainer=M5Stack sentence=Library for M5Stack UNIT ENV @@ -8,4 +8,4 @@ category=Device Control url=https://github.com/m5stack/M5Unit-ENV architectures=esp32 includes=M5_ENV.h -depends=Adafruit BMP280 Library,Adafruit Unified Sensor \ No newline at end of file +depends=Adafruit BMP280 Library,Adafruit Unified Sensor,Adafruit BusIO \ No newline at end of file