This commit is contained in:
LiHuashen
2018-12-26 20:21:20 +08:00
parent 83875813c2
commit 28b2b81648
18 changed files with 187 additions and 167 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+1 -8
View File
@@ -60,8 +60,6 @@
<img src='assets/img/product_pics/3.jpg'> <img src='assets/img/product_pics/unit.png'>
**Input/Sensing Unit**
[![M5GO_Unit_env.png](https://i.loli.net/2018/12/13/5c12229aed8e7.png)](en/unit/env)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_ir.png](https://i.loli.net/2018/12/13/5c1222c75a47c.png)](en/unit/ir)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_pir.png](https://i.loli.net/2018/12/13/5c1222b138916.png)](en/unit/pir)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_angle.png](https://i.loli.net/2018/12/13/5c1219eb78c21.png)](en/unit/angle)
[![M5GO_Unit_adc.png](https://i.loli.net/2018/12/13/5c12192a6110d.png)](en/unit/adc)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_dac.png](https://i.loli.net/2018/12/13/5c1219d495a9a.png)](en/unit/dac)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_button.png](https://i.loli.net/2018/12/13/5c121a068c209.png)](en/unit/button)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_dual_button.png](https://i.loli.net/2018/12/13/5c121a1adfedb.png)](en/unit/dual_button)
@@ -73,14 +71,9 @@
[![M5GO_Unit_tof.png](https://i.loli.net/2018/12/13/5c121e5cd47e1.png)](en/unit/tof)
<!-- |[ADC]()|[数字模拟转换Unit]()|[单按键]()|[双按键]()| -->
**Output/Controlling Unit**
[![M5GO_Unit_rgb.png](https://i.loli.net/2018/12/13/5c121f5c98542.png)](en/unit/rgb)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_relay.png](https://i.loli.net/2018/12/13/5c121f6e9a185.png)](en/unit/relay)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_neopixel.png](https://i.loli.net/2018/12/13/5c121f8457fcb.png)](en/unit/neopixel)
**Interface Unit**
[![M5GO_Unit_hub_01.png](https://i.loli.net/2018/12/13/5c121f970bb1f.png)](en/unit/hub)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_3.96_01.png](https://i.loli.net/2018/12/13/5c121fac3607e.png)](en/unit/396port)
[![M5GO_Unit_proto_01.png](https://i.loli.net/2018/12/13/5c121e125b2fe.png)](en/unit/proto)
[![M5GO_Unit_hub_01.png](https://i.loli.net/2018/12/13/5c121f970bb1f.png)](en/unit/hub)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_3.96_01.png](https://i.loli.net/2018/12/13/5c121fac3607e.png)](en/unit/396port)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_proto_01.png](https://i.loli.net/2018/12/13/5c121e125b2fe.png)](en/unit/proto)
***
+30 -21
View File
@@ -4,7 +4,8 @@
* * *
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;:bulb:**[上手指南](zh_CN/quick_start/m5core/m5stick_get_started_arduino)**&nbsp;&nbsp;&nbsp;:octocat:**[例程](https://github.com/m5stack/M5Stack/tree/master/examples/Stick/FactoryTest)**&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.257b425esTi92S&id=581055502939)**&nbsp;&nbsp;&nbsp;
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;:bulb:**[上手指南](zh_CN/quick_start/m5core/m5stick_get_started_arduino)**&nbsp;&nbsp;&nbsp;:octocat:**[例程](https://github.com/m5stack/M5Stack/tree/master/examples/Stick/FactoryTest)**&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.257b425esTi92S&id=581055502939)**&nbsp;&nbsp;&nbsp;:clapper:**[相关视频](#相关视频)**
## 描述
<mark>**M5Stick**</mark> 是一个包含1.3寸OLED屏幕(64x128),LED灯,按键,蜂鸣器,红外发射管和80mA的电池的小型ESP32开发板。你通常可以将它戴在手腕上,也可以利用我们的配件将它固定到墙上。
@@ -19,34 +20,36 @@ M5Stick有两个版本,第一个是无PSRAM的版本,另外一个是有MPU92
## 管脚映射
| *BLUE_LED* | *ESP32* |
| :----------: |:------------: |
| LED_Pin | GPIO19 |
**蓝色LED&按键BUTTON&蜂鸣器BUZZER&红外发射管IR**
| *BUTTON按键* | *ESP32* |
| :----------: |:------------: |
| Button_Pin | GPIO35 |
<table>
<tr><td>ESP32芯片</td><td>GPIO17</td><td>GPIO19</td><td>GPIO26</td><td>GPIO35</td></tr>
<tr><td>红外发射管IR</td><td>发射管引脚</td><td> </td><td> </td><td> </td></tr>
<tr><td>蓝色LED</td><td> </td><td>LED管脚</td><td> </td><td> </td></tr>
<tr><td>蜂鸣器BUZZER</td><td> </td><td> </td><td>蜂鸣器管脚</td></tr>
<tr><td>按键BUTTON</td><td> </td><td> </td><td> </td><td>按键管脚</td></tr>
</table>
| *BUZZER蜂鸣器* | *ESP32* |
| :----------: |:------------: |
| Buzzer_Pin | GPIO26 |
**OLED屏幕**
| *IR红外发射管* | *ESP32* |
| :----------: |:------------: |
| Buzzer_Pin | GPIO17 |
<table>
<tr><td>ESP32芯片</td><td>GPIO14</td><td>GPIO27</td><td>GPIO33</td>
<tr><td>OLED屏幕</td><td>CS</td><td>DC</td><td>RST</td>
</table>
| *GROVE* | *ESP32* |
| :----------: |:------------: |
| SDA | GPIO25 |
| SCL | GPIO13 |
**GROVE接口**
<table>
<tr><td>ESP32芯片</td><td>GPIO13</td><td>GPIO25</td><td>5V</td><td>GND</td></tr>
<tr><td>GROVE接口</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>
**可选:**
| *MPU9250* | *ESP32* |
| :----------: |:------------: |
| SDA | GPIO22 |
| SCL | GPIO21 |
<table>
<tr><td>ESP32芯片</td><td>GPIO22</td><td>GPIO21</td>
<tr><td>九轴姿态传感器MPU9250</td><td>SCL</td><td>SDA</td>
</table>
## 包含
@@ -59,3 +62,9 @@ M5Stick有两个版本,第一个是无PSRAM的版本,另外一个是有MPU92
## 相关链接
- **数据手册** - [ESP32](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_cn.pdf) - [MPU9250](https://www.invensense.com/wp-content/uploads/2015/02/PS-MPU-9250A-01-v1.1.pdf)
## 相关视频
- **m5stack的简介**
<iframe height=498 width=510 src='https://player.youku.com/embed/XMzkzMjQ4NzIyOA==' frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@@ -1,5 +1,5 @@
# M5Core 上手指南(macOS, Arudino)
# Core 上手指南(macOS, Arudino)
?> 如果你的操作系统是Windows,请点击[这里](zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows)。
@@ -1,4 +1,4 @@
# M5Core 上手指南(Windows, Arudino)
# Core 上手指南(Windows, Arudino)
?> 如果你的操作系统是MacOS的话,请点击[这里](zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS)。
@@ -1,5 +1,7 @@
# M5Stick 上手指南(Arduino)
*M5Stick因为主控芯片同样为ESP32,所以环境搭建与[M5Core](zh_CN/quick_start/m5core/m5stack_core_quick_start)基本一样,用户可以参考M5Core的步骤进行,所以步骤二会跳转到M5Core的环境搭建。*
## 1. 安装`U8g2`库
如果你已经安装了`U8g2`库的话,直接跳到第二步往下执行。
@@ -11,7 +13,7 @@
## 2. Arduino-ESP32的开发设置
请根据你PC的操作系统类型阅读对应的文档。
请根据你PC的操作系统类型阅读对应的文档。以下会跳转到M5Core一样的环境搭建步骤中。
<img src="assets/img/macos-logo.png"> | <img src="assets/img/windows-logo.png">
---|---
+52 -13
View File
@@ -4,11 +4,13 @@
***
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.37.3a93425e5PQbBs&id=580131730176)**
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.37.3a93425e5PQbBs&id=580131730176)**
<!-- :memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.37.3a93425e5PQbBs&id=580131730176)** -->
## 描述
这是带自校准功能的16位模拟数字转换unit,相比ESP32芯片自带的ADC(12位)功能分辨率高了不少,意味着你可以测量更小幅值的电压等模拟量,也就是能测量更细微一倍的模拟量,比如采集心电电压做心电监护项目、做血压监测项目、高精度电压监控项目等等。unit集成的ADC芯片通过I2C接口与M5的主控通讯(I2C地址为0x48),可以设置成单周期转换和连续转换方式。
这是带自校准功能的16位模拟数字转换unit,相比ESP32芯片自带的ADC(12位)功能分辨率高了不少,意味着你可以测量更小幅值的电压等模拟量,也就是能测量更细微一倍的模拟量,比如采集心电电压做心电监护项目、做血压监测项目、高精度电压监控项目等等。unit集成的ADC芯片**ADS1100**通过I2C接口与M5的主控通讯(I2C地址为0x48),可以设置成单周期转换和连续转换方式。
## 特性
@@ -24,7 +26,7 @@
- 血压测量
- 测力计
## 文档
## 相关链接
- **[官方频道视频](https://i.youku.com/i/UNjE1ODA2MzE0OA==?spm=a2hzp.8253869.0.0)**
@@ -36,17 +38,54 @@
### 1. Arduino IDE
```arduino
ADS1100 ads;//new a object
ads.getAddr_ADS1100(0x48);//ADS1100_DEFAULT_ADDRESS: 0x48
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ADC/Arduino)。*
ads.setOSMode(OSMODE_SINGLE);// Set to start a single-conversion
result = ads.Measure_Differential();//Reads the conversion results
```arduino
#include <M5Stack.h>
#include <Wire.h>
#include "ADS1100.h"
ADS1100 ads;//new a object
void setup(void)
{
M5.begin(true, false, false);
//The address can be changed making the option of connecting multiple devices
ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);// 0x48, 1001 000 (ADDR = GND)
// The ADC gain (PGA), Device operating mode, Data rate
// can be changed via the following functions
ads.setGain(GAIN_ONE); // 1x gain(default)
ads.setMode(MODE_CONTIN); // Continuous conversion mode (default)
ads.setRate(RATE_8); // 8SPS (default)
ads.setOSMode(OSMODE_SINGLE); // Set to start a single-conversion
ads.begin();
}
void loop(void)
{
byte error;
int8_t address;
address = ads.ads_i2cAddress;
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
int16_t result;
result = ads.Measure_Differential();
}
else
{
Serial.println("ADS1100 Disconnected!");
}
delay(1000);
}
```
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ADC/Arduino)。
### 2. UIFlow
<!-- ### 2. UIFlow -->
<!-- <img src="assets/img/product_pics/unit/unit_example/example_unit_adc_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/example_unit_adc_02.png" width="55%" height="55%">
@@ -59,6 +98,6 @@ result = ads.Measure_Differential();//Reads the conversion results
### 管脚映射
<table>
<tr><td>M5Core(GROVE A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
<tr><td>ADC Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
<tr><td>M5Core(GROVE接口A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
<tr><td>模数转换Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>
+3 -17
View File
@@ -25,38 +25,24 @@ ANGLE是一个电位器Unit,通过这个Unit可以检测手动旋转的角度.
### 1. Arduino IDE
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino)。*
```arduino
#include <M5Stack.h>
// select the input pin for the potentiometer
int sensorPin = 36;
// last variable to store the value coming from the sensor
int last_sensorValue = 0;
// current variable to store the value coming from the sensor
int cur_sensorValue = 0;
void setup() {
M5.begin();
pinMode(sensorPin, INPUT);
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(0, 0);
M5.Lcd.print("the value of ANGLE: ");
}
void loop() {
// read the value from the sensor:
cur_sensorValue = analogRead(sensorPin);
M5.Lcd.setCursor(0, 25);
if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce
M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
M5.Lcd.print(cur_sensorValue);
last_sensorValue = cur_sensorValue;
}
delay(50);
}
```
具体例程`potentiometer_read.ino`请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino)。
### 2. UIFlow
<img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_02.png" width="69%" height="69%">
@@ -71,5 +57,5 @@ void loop() {
<table>
<tr><td>M5Core(GROVE B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>ANGLE Unit</td><td>ANGLE Pin</td><td> </td><td>5V</td><td>GND</td></tr>
<tr><td>角度传感器Unit</td><td>传感器引脚</td><td> </td><td>5V</td><td>GND</td></tr>
</table>
+11 -33
View File
@@ -25,54 +25,32 @@ BUTTON是一个单按键unit,这个Unit能检测你是否按下了.
### 1. Arduino IDE
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/Arduino)。*
```arduino
#include <M5Stack.h>
int last_value = 0;
int cur_value = 0;
void setup() {
M5.begin();// init
Serial.begin(115200);
pinMode(36, INPUT);
M5.Lcd.clear(BLACK);
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(80, 0); M5.Lcd.println("Button example");
Serial.println("Button example: ");
M5.Lcd.setTextColor(WHITE);
pinMode(36, INPUT);// BUTTON Pin
}
void loop() {
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;
}
Serial.println(cur_value);
M5.update();
}
```
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/Arduino)。
### 2. UIFlow
<img src="assets/img/product_pics/unit/unit_example/example_unit_button_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/example_unit_button_02.png" width="55%" height="55%">
<!-- <img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/1.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/2.png" width="55%" height="55%"><img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/3.png" width="55%" height="55%"> -->
<img src="assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_04.png" width="55%" height="55%">
<!-- width="30%" height="30%" -->
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/UIFlow)。
@@ -83,6 +61,6 @@ void loop() {
### 管脚映射
<table>
<tr><td>M5Core(GROVE A)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>BUTTON Unit</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>M5Core(GROVE接口B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>单按键Unit</td></td><td>按键引脚</td><td> </td><td>5V</td><td>GND</td></tr>
</table>
+12 -19
View File
@@ -4,11 +4,13 @@
***
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.28.312f425eRDFbqp&id=580257615943)**
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.28.312f425eRDFbqp&id=580257615943)**
<!-- :memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.28.312f425eRDFbqp&id=580257615943)** -->
## 描述
<mark>DAC</mark>是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是MCP4725,并且不带EEPROM。
<mark>DAC</mark>是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。
## 特性
@@ -33,7 +35,9 @@
## 例程
### 1. Arduino IDE
<!--
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DAC/Arduino)。*
```arduino
/*
hardware : m5stack uint dac
@@ -46,32 +50,21 @@
Adafruit_MCP4725 dac;
void setup(void) {
Serial.begin(115200);
Serial.println("Hello!");
// For Adafruit
///the address of MCP4725A1 is 0x62 (default) or 0x63 (ADDR pin tied to VCC)
// the address of MCP4725A0 is 0x60 or 0x61
// the address of MCP4725A2 is 0x64 or 0x65
dac.begin(0x60);
Serial.println("Generating a triangle wave");
dac.setVoltage(2048, false);
}
void loop(void) {
// 12bit value , false mean not write EEPROM
dac.setVoltage(1024, false);
dac.setVoltage(1024, false);// input digital value "1024"
delay(1000);
dac.setVoltage(2048, false);
dac.setVoltage(2048, false);// input digital value "2048"
delay(1000);
}
```
<!-- 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DAC/Arduino)。 -->
### 2. UIFlow
<!-- ### 2. UIFlow -->
<!-- <img src="assets/img/product_pics/unit/unit_example/example_unit_dac_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/example_unit_dac_02.png" width="55%" height="55%">
@@ -84,6 +77,6 @@ void loop(void) {
### 管脚映射
<table>
<tr><td>M5Core(GROVE A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
<tr><td>DAC Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
<tr><td>M5Core(GROVE接口A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
<tr><td>数模转换Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>
+26 -12
View File
@@ -4,7 +4,9 @@
***
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.58.3a93425e5PQbBs&id=577469112270)**
:memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.58.3a93425e5PQbBs&id=577469112270)**
<!-- :memo:**[描述](#描述)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[例程](#例程)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[原理图](#原理图)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.58.3a93425e5PQbBs&id=577469112270)** -->
## 描述
@@ -25,30 +27,42 @@
### 1. Arduino IDE
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DUAL_BUTTON/Arduino)。*
```arduino
DHT12 dht12; //new a object
Adafruit_BMP280 bme;
#include <M5Stack.h>
float tmp = dht12.readTemperature();//temperature
float hum = dht12.readHumidity();//humidity
float pressure = bme.readPressure();//pressure
void setup() {
M5.begin();// init
Serial.begin(115200);
pinMode(26, INPUT);// Red Button Pin
pinMode(36, INPUT);// Blue Button Pin
}
void loop() {
cur_value_red = digitalRead(26);
cur_value_blue = digitalRead(36);
Serial.print(cur_value_red);
Serial.println(cur_value_blue);
M5.update();
}
```
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DUAL_BUTTON/Arduino)。
### 2. UIFlow
<img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/1.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/2.png" width="55%" height="55%"><img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/3.png" width="55%" height="55%"><img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/4.png" width="55%" height="55%">
<!-- <img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/1.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/2.png" width="55%" height="55%"><img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/3.png" width="55%" height="55%"> -->
<img src="assets/img/product_pics/unit/unit_example/DUAL_BUTTON/example_unit_dual_button_04.png" width="55%" height="55%">
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DUAL_BUTTON/UIFlow)。
## 原理图
<!-- ## 原理图 -->
<!-- <img src="assets/img/product_pics/unit/dual_button_sch.JPG"> -->
### 管脚映射
<table>
<tr><td>M5Core(GROVE B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>DUAL_BUTTON Unit</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>M5Core(GROVE接口B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>双按键Unit</td><td>蓝色按键引脚</td><td>红色按键引脚</td><td>5V</td><td>GND</td></tr>
</table>
+26 -6
View File
@@ -34,13 +34,33 @@
### 1. Arduino IDE
```arduino
float tmp = dht12.readTemperature();//temperature
float hum = dht12.readHumidity();//humidity
float pressure = bme.readPressure();//pressure
```
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ENV/Arduino)。*
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ENV/Arduino)。
```arduino
#include <M5Stack.h>
#include "DHT12.h"
#include <Wire.h> //The DHT12 uses I2C comunication.
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
DHT12 dht12; //Preset scale CELSIUS and ID 0x5c.
Adafruit_BMP280 bme;
void setup() {
M5.begin();
Wire.begin();
if (!bme.begin()){
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
}
void loop() {
float tmp = dht12.readTemperature();
float hum = dht12.readHumidity();
float pressure = bme.readPressure();
}
```
### 2. UIFlow
+7 -26
View File
@@ -29,44 +29,25 @@
### 1. Arduino IDE
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/IR/Arduino)。*
```arduino
#include <M5Stack.h>
// select the input pin for the potentiometer
int ir_recv_pin = 36;
int ir_send_pin = 26;
int last_recv_value = 0;
int cur_recv_value = 0;
void setup() {
M5.begin();
pinMode(ir_recv_pin, INPUT);
pinMode(ir_send_pin, OUTPUT);
pinMode(ir_recv_pin, INPUT);// receiver pin
pinMode(ir_send_pin, OUTPUT);// transmitter pin
//send infrared light
//now, you can see the infrared light through mobile phone camera
digitalWrite(ir_send_pin, 1);
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(0, 0);
M5.Lcd.print("Test for IR receiver: ");
digitalWrite(ir_send_pin, 1);// send infrared light
}
void loop() {
//now, once you press the button on a remote controller to send infrared light
//the screen will display "detected!"
cur_recv_value = digitalRead(ir_recv_pin);
if(last_recv_value != cur_recv_value){
M5.Lcd.setCursor(0, 25);
M5.Lcd.fillRect(0, 25, 150, 25, BLACK);
if(cur_recv_value == 0){//0: detected 1: not detected
M5.Lcd.print("detected!");
}
last_recv_value = cur_recv_value;
}
delay(100);
cur_recv_value = digitalRead(ir_recv_pin);// read the status of receiver
}
```
具体例程`ir_dectect.ino`请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/IR/Arduino)。
### 2. UIFlow
<img src="assets/img/product_pics/unit/unit_example/IR/example_unit_ir_01.png" width="50%" height="50%"> <img src="assets/img/product_pics/unit/unit_example/IR/example_unit_ir_02.png" width="30%" height="30%">
@@ -81,5 +62,5 @@ void loop() {
<table>
<tr><td>M5Core(GROVE B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>IR Unit</td><td>Receiver Pin</td><td>Transmitter Pin</td><td>5V</td><td>GND</td></tr>
<tr><td>红外对管Unit</td><td>红外接收器引脚</td><td>红外发送器引脚</td><td>5V</td><td>GND</td></tr>
</table>
+14 -9
View File
@@ -24,19 +24,24 @@
## 例程
<!-- ### 1. Arduino IDE
### 1. Arduino IDE
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PIR/Arduino)。*
```arduino
DHT12 dht12; //new a object
Adafruit_BMP280 bme;
#include <M5Stack.h>
float tmp = dht12.readTemperature();//temperature
float hum = dht12.readHumidity();//humidity
float pressure = bme.readPressure();//pressure
void setup() {
M5.begin();
pinMode(36, INPUT);// set pir sensor pin as input
}
void loop() {
int value = digitalRead(36);// read the pin
M5.update();
}
```
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PIR/Arduino)。 -->
### 2. UIFlow
<img src="assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_02.png" width="68%" height="68%">
@@ -51,5 +56,5 @@ float pressure = bme.readPressure();//pressure
<table>
<tr><td>M5Core(GROVE B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>PIR Unit</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
<tr><td>人体红外感应Unit</td><td>红外感应引脚</td><td> </td><td>5V</td><td>GND</td></tr>
</table>