From b75cf864f2ccaceba6521ceb0f5b9fbfd717c374 Mon Sep 17 00:00:00 2001
From: LiHuashen <854410664@qq.com>
Date: Wed, 26 Dec 2018 17:45:34 +0800
Subject: [PATCH] add btc
---
docs/en/base/btc_base.md | 81 +++++++++++
docs/en/module/btc.md | 48 -------
docs/en/unit/button.md | 44 +++---
docs/index.md | 2 +-
docs/zh_CN/README.md | 4 +-
.../zh_CN/{module/btc.md => base/btc_base.md} | 132 ++++++++++--------
docs/zh_CN/unit/button.md | 48 ++++++-
docs/zh_CN/unit/dual_button.md | 6 +-
8 files changed, 233 insertions(+), 132 deletions(-)
create mode 100644 docs/en/base/btc_base.md
delete mode 100644 docs/en/module/btc.md
rename docs/zh_CN/{module/btc.md => base/btc_base.md} (53%)
diff --git a/docs/en/base/btc_base.md b/docs/en/base/btc_base.md
new file mode 100644
index 00000000..4bccef68
--- /dev/null
+++ b/docs/en/base/btc_base.md
@@ -0,0 +1,81 @@
+# M5Stack BTC Module
+
+
+
+
+
+***
+
+:memo:**[Description](#Description)** :octocat:**[Example](#Example)** 🛒**[Purchase](https://www.aliexpress.com/store/product/M5Stack-Official-Stock-Offer-GPS-Module-with-Internal-External-Antenna-MCX-Interface-IoT-Development-Board-for/3226069_32840757048.html?spm=2114.12010615.8148356.2.7c6c2743BZthY3)**
+
+
+
+# Description
+
+The M5Stack BTC Module is a base including DHT12 module which can detect
+temperature and humidity. Your M5Stack Core board can stay as a small
+displayer(like a small TV or a small IOT central contronller) after
+adding this BTC Module. Absolutely, it is more easier to charge M5Stack
+Core via Type-C Cable after adding this BTC Module.
+
+# Feature
+
+- DHT12 inside
+
+# Include
+
+- Type-C USB Cable
+- M3 x 16
+- Tools
+
+# PinMap
+
+**DHT12**
+
+| DHT12 | ESP32 |
+| :----------: |:------------:|
+| SCL | G22 |
+| GND | GND |
+| SDA | G21 |
+| 3V3 | 3V3 |
+
+
+
+
+# Related Link
+
+- **[Offical Video](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
+
+- **[Forum](http://forum.m5stack.com/)**
+
+## Example
+
+### Arduino IDE
+
+```arduino
+#include
+#include "DHT12.h"
+#include //The DHT12 uses I2C comunication.
+
+void setup() {
+ M5.begin();
+ Wire.begin();
+ M5.Lcd.setBrightness(10);
+ Serial.println(F("ENV Unit(DHT12 and BMP280) test..."));
+}
+
+void loop() {
+ float tmp = dht12.readTemperature();
+ float hum = dht12.readHumidity();
+ Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%%\r\n", tmp, hum);
+
+ M5.Lcd.setCursor(0, 0);
+ M5.Lcd.setTextColor(WHITE, BLACK);
+ M5.Lcd.setTextSize(3);
+ M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\n", tmp, hum);
+
+ delay(100);
+}
+```
+
+For specific example `BTC.ino`, click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Base/BTC/Arduino) please.
\ No newline at end of file
diff --git a/docs/en/module/btc.md b/docs/en/module/btc.md
deleted file mode 100644
index eb0c8c77..00000000
--- a/docs/en/module/btc.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# M5Stack BTC Module
-
-
-
-
-
-***
-
-:memo:**[Description](#Description)** :octocat:**[Example](#Example)** :electric_plug:**[Schematic](#Schematic)** 🛒**[Purchase](https://www.aliexpress.com/store/product/M5Stack-Official-Stock-Offer-GPS-Module-with-Internal-External-Antenna-MCX-Interface-IoT-Development-Board-for/3226069_32840757048.html?spm=2114.12010615.8148356.2.7c6c2743BZthY3)**
-
-# Description
-
-The M5Stack BTC Module is a base including DHT12 module which can detect
-temperature and humidity. Your M5Stack Core board can stay as a small
-displayer(like a small TV or a small IOT central contronller) after
-adding this BTC Module. Absolutely, it is more easier to charge M5Stack
-Core via Type-C Cable after adding this BTC Module.
-
-# Feature
-
-- DHT12 inside
-
-# Include
-
-- Type-C USB Cable
-- M3 x 16
-- Tools
-
-# PinMap
-
-**DHT12**
-
-| DHT12 | ESP32 |
-| :----------: |:------------:|
-| SCL | G22 |
-| GND | GND |
-| SDA | G21 |
-| 3V3 | 3V3 |
-
-
-
-
-# Related Link
-
-- **[Offical Video](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
-
-- **[Forum](http://forum.m5stack.com/)**
-
diff --git a/docs/en/unit/button.md b/docs/en/unit/button.md
index 94b673c6..4ec6649f 100644
--- a/docs/en/unit/button.md
+++ b/docs/en/unit/button.md
@@ -25,32 +25,44 @@ The Unit BUTTON is a sigle-button unit that can be detected whether the button p
```arduino
#include
+
+int last_value = 0;
+int cur_value = 0;
+
void setup() {
- // init lcd
- M5.begin();
+ M5.begin();// init
+ Serial.begin(115200);
pinMode(36, INPUT);
M5.Lcd.clear(BLACK);
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.setTextSize(2);
- M5.Lcd.setCursor(65, 10);
- M5.Lcd.println("Button example");
- M5.Lcd.setTextColor(RED);
+ M5.Lcd.setCursor(80, 0); M5.Lcd.println("Button example");
+ Serial.println("Button example: ");
+ M5.Lcd.setTextColor(WHITE);
}
void loop() {
- M5.update();
-
- if(digitalRead(36)==0)
- {
- while(1)
- {
- if(digitalRead(36)==1)
- {
- M5.Lcd.print("1");
- break;
- }
+ cur_value = digitalRead(36);// read the value of BUTTON
+ M5.Lcd.setCursor(0,25); M5.Lcd.print("Status: ");
+ M5.Lcd.setCursor(0,45); M5.Lcd.print("Value: ");
+ if(cur_value != last_value){
+ M5.Lcd.fillRect(95,25,100,25,BLACK);
+ M5.Lcd.fillRect(95,45,100,25,BLACK);
+ if(cur_value==0){
+ M5.Lcd.setCursor(95,25); M5.Lcd.print("pressed");// display the status
+ M5.Lcd.setCursor(95,45); M5.Lcd.print("0");
+ Serial.println("Button Status: pressed");
+ Serial.println(" value: 0");
}
+ else{
+ M5.Lcd.setCursor(95,25); M5.Lcd.print("released");// display the status
+ M5.Lcd.setCursor(95,45); M5.Lcd.print("1");
+ Serial.println("Button Status: released");
+ Serial.println(" value: 1");
+ }
+ last_value = cur_value;
}
+ M5.update();
}
```
diff --git a/docs/index.md b/docs/index.md
index d8dba83f..a50c55e1 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -52,7 +52,7 @@
-[](en/base/lan_base) [](en/base/node_base)
+[](en/base/lan_base) [](en/base/node_base) [](en/base/btc_base)
diff --git a/docs/zh_CN/README.md b/docs/zh_CN/README.md
index 014482c3..5cdd44df 100644
--- a/docs/zh_CN/README.md
+++ b/docs/zh_CN/README.md
@@ -46,7 +46,7 @@
-[](zh_CN/base/lan_base) [](zh_CN/base/node_base)
+[](zh_CN/base/lan_base) [](zh_CN/base/node_base) [](zh_CN/base/btc_base)
@@ -88,7 +88,7 @@
-[](zh_CN/unit/hub) [](zh_CN/unit/396port) [](zh_CN/unit/proto)
+[](zh_CN/unit/hub)[](zh_CN/unit/396port)[](zh_CN/unit/proto)
diff --git a/docs/zh_CN/module/btc.md b/docs/zh_CN/base/btc_base.md
similarity index 53%
rename from docs/zh_CN/module/btc.md
rename to docs/zh_CN/base/btc_base.md
index 183b9b5c..cd2bcd3c 100644
--- a/docs/zh_CN/module/btc.md
+++ b/docs/zh_CN/base/btc_base.md
@@ -1,55 +1,77 @@
-# BTC底座
-
-
-
-
-
-***
-
-:memo:**[描述](#描述)** :octocat:**[例程](#例程)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.10.69f6425e8Agsbh&id=559647865340)**
-
-# 描述
-
-BTC模块是一款包含DHT12(温湿度)传感器的底座。有了BTC底座之后,可以方便给M5Core充电。
-
-# 特性
-
-- 内置DHT12
-
-# 包含
-
-- Type-C USB线
-- M3 x 16
-- Tools
-
-# 管脚映射
-
-**DHT12**
-
-| DHT12 | ESP32 |
-| :----------: |:------------:|
-| SCL | G22 |
-| GND | GND |
-| SDA | G21 |
-| 3V3 | 3V3 |
-
-
-
-## 相关链接
-
-- **[官方频道视频](https://i.youku.com/i/UNjE1ODA2MzE0OA==?spm=a2hzp.8253869.0.0)**
-
-- **[官方论坛](http://forum.m5stack.com/)**
-
-## 例程
-
-### 1. Arduino IDE
-
-```arduino
-float tmp = dht12.readTemperature();//temperature
-float hum = dht12.readHumidity();//humidity
-```
-
-具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ENV/Arduino)。
-
-## 原理图
+# BTC底座
+
+
+
+
+
+***
+
+:memo:**[描述](#描述)** :octocat:**[例程](#例程)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.10.69f6425e8Agsbh&id=559647865340)**
+
+
+
+
+# 描述
+
+BTC模块是一款包含DHT12(温湿度)传感器的底座。有了BTC底座之后,可以方便给M5Core充电。
+
+# 特性
+
+- 内置DHT12
+
+# 包含
+
+- Type-C USB线
+- M3 x 16
+- Tools
+
+# 管脚映射
+
+**DHT12**
+
+| DHT12 | ESP32 |
+| :----------: |:------------:|
+| SCL | G22 |
+| GND | GND |
+| SDA | G21 |
+| 3V3 | 3V3 |
+
+
+
+## 相关链接
+
+- **[官方频道视频](https://i.youku.com/i/UNjE1ODA2MzE0OA==?spm=a2hzp.8253869.0.0)**
+
+- **[官方论坛](http://forum.m5stack.com/)**
+
+## 例程
+
+### Arduino IDE
+
+```arduino
+#include
+#include "DHT12.h"
+#include //The DHT12 uses I2C comunication.
+
+void setup() {
+ M5.begin();
+ Wire.begin();
+ M5.Lcd.setBrightness(10);
+ Serial.println(F("ENV Unit(DHT12 and BMP280) test..."));
+}
+
+void loop() {
+ float tmp = dht12.readTemperature();
+ float hum = dht12.readHumidity();
+ Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%%\r\n", tmp, hum);
+
+ M5.Lcd.setCursor(0, 0);
+ M5.Lcd.setTextColor(WHITE, BLACK);
+ M5.Lcd.setTextSize(3);
+ M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\n", tmp, hum);
+
+ delay(100);
+}
+```
+
+具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Base/BTC/Arduino)。
diff --git a/docs/zh_CN/unit/button.md b/docs/zh_CN/unit/button.md
index 0298eb06..b33aed2d 100644
--- a/docs/zh_CN/unit/button.md
+++ b/docs/zh_CN/unit/button.md
@@ -23,15 +23,49 @@ BUTTON是一个单按键unit,这个Unit能检测你是否按下了.
## 例程
-
+具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/UIFlow)。
## 原理图
diff --git a/docs/zh_CN/unit/dual_button.md b/docs/zh_CN/unit/dual_button.md
index 37a7731d..f5eb2ba4 100644
--- a/docs/zh_CN/unit/dual_button.md
+++ b/docs/zh_CN/unit/dual_button.md
@@ -23,7 +23,7 @@
## 例程
-
+具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DUAL_BUTTON/UIFlow)。
## 原理图