Skip to content

Commit

Permalink
Add Unit BPS example
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyu-Zhao committed Aug 18, 2022
1 parent 7dc1c6f commit faddeec
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
44 changes: 44 additions & 0 deletions examples/Unit_BPS_M5Core/Unit_BPS_M5Core.ino
Original file line number Diff line number Diff line change
@@ -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 <M5Stack.h>
#include <Adafruit_BMP280.h>

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);
}
43 changes: 43 additions & 0 deletions examples/Unit_BPS_M5Core2/Unit_BPS_M5Core2.ino
Original file line number Diff line number Diff line change
@@ -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 <M5Core2.h>
#include <Adafruit_BMP280.h>

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);
}
42 changes: 42 additions & 0 deletions examples/Unit_BPS_M5StickC/Unit_BPS_M5StickC.ino
Original file line number Diff line number Diff line change
@@ -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 <M5StickC.h>
#include <Adafruit_BMP280.h>

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);
}
42 changes: 42 additions & 0 deletions examples/Unit_BPS_M5StickCPlus/Unit_BPS_M5StickCPlus.ino
Original file line number Diff line number Diff line change
@@ -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 <M5StickCPlus.h>
#include <Adafruit_BMP280.h>

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);
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
depends=Adafruit BMP280 Library,Adafruit Unified Sensor,Adafruit BusIO

0 comments on commit faddeec

Please sign in to comment.