diff --git a/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_01.png b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_01.png new file mode 100644 index 00000000..11d29cfb Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_02.png b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_02.png new file mode 100644 index 00000000..49664933 Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_02.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_03.png b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_03.png new file mode 100644 index 00000000..bc90d3e7 Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_03.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_04.png b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_04.png new file mode 100644 index 00000000..22d5404e Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/BUTTON/example_unit_button_04.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/DUAL_BUTTON/example_unit_dual_button_04.png b/docs/assets/img/product_pics/unit/unit_example/DUAL_BUTTON/example_unit_dual_button_04.png new file mode 100644 index 00000000..7450d6a4 Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/DUAL_BUTTON/example_unit_dual_button_04.png differ diff --git a/docs/index.md b/docs/index.md index bf541650..cb54e8b4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -60,8 +60,6 @@ -**Input/Sensing Unit** - [![M5GO_Unit_env.png](https://i.loli.net/2018/12/13/5c12229aed8e7.png)](en/unit/env)         [![M5GO_Unit_ir.png](https://i.loli.net/2018/12/13/5c1222c75a47c.png)](en/unit/ir)         [![M5GO_Unit_pir.png](https://i.loli.net/2018/12/13/5c1222b138916.png)](en/unit/pir)         [![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)         [![M5GO_Unit_dac.png](https://i.loli.net/2018/12/13/5c1219d495a9a.png)](en/unit/dac)         [![M5GO_Unit_button.png](https://i.loli.net/2018/12/13/5c121a068c209.png)](en/unit/button)         [![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) -**Output/Controlling Unit** - [![M5GO_Unit_rgb.png](https://i.loli.net/2018/12/13/5c121f5c98542.png)](en/unit/rgb)         [![M5GO_Unit_relay.png](https://i.loli.net/2018/12/13/5c121f6e9a185.png)](en/unit/relay)         [![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)         [![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)         [![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) *** diff --git a/docs/zh_CN/core/m5stick.md b/docs/zh_CN/core/m5stick.md index 7248720a..e6d8005e 100644 --- a/docs/zh_CN/core/m5stick.md +++ b/docs/zh_CN/core/m5stick.md @@ -4,7 +4,8 @@ * * * -:memo:**[描述](#描述)**   :bulb:**[上手指南](zh_CN/quick_start/m5core/m5stick_get_started_arduino)**   :octocat:**[例程](https://github.com/m5stack/M5Stack/tree/master/examples/Stick/FactoryTest)**   :electric_plug:**[原理图](#原理图)**   🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.257b425esTi92S&id=581055502939)**    +:memo:**[描述](#描述)**   :bulb:**[上手指南](zh_CN/quick_start/m5core/m5stick_get_started_arduino)**   :octocat:**[例程](https://github.com/m5stack/M5Stack/tree/master/examples/Stick/FactoryTest)**   :electric_plug:**[原理图](#原理图)**   🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.257b425esTi92S&id=581055502939)**   :clapper:**[相关视频](#相关视频)** + ## 描述 **M5Stick** 是一个包含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 | + + + + + + +
ESP32芯片GPIO17GPIO19GPIO26GPIO35
红外发射管IR发射管引脚
蓝色LED LED管脚
蜂鸣器BUZZER 蜂鸣器管脚
按键BUTTON 按键管脚
-| *BUZZER蜂鸣器* | *ESP32* | -| :----------: |:------------: | -| Buzzer_Pin | GPIO26 | +**OLED屏幕** -| *IR红外发射管* | *ESP32* | -| :----------: |:------------: | -| Buzzer_Pin | GPIO17 | + + + +
ESP32芯片GPIO14GPIO27GPIO33
OLED屏幕CSDCRST
-| *GROVE* | *ESP32* | -| :----------: |:------------: | -| SDA | GPIO25 | -| SCL | GPIO13 | +**GROVE接口** + + + +
ESP32芯片GPIO13GPIO255VGND
GROVE接口SCLSDA5VGND
**可选:** -| *MPU9250* | *ESP32* | -| :----------: |:------------: | -| SDA | GPIO22 | -| SCL | GPIO21 | + + + +
ESP32芯片GPIO22GPIO21
九轴姿态传感器MPU9250SCLSDA
## 包含 @@ -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的简介** + + \ No newline at end of file diff --git a/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md b/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md index da99d4ea..35d129f2 100644 --- a/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md +++ b/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS.md @@ -1,5 +1,5 @@ -# M5Core 上手指南(macOS, Arudino) +# Core 上手指南(macOS, Arudino) ?> 如果你的操作系统是Windows,请点击[这里](zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows)。 diff --git a/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows.md b/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows.md index 19f93eef..d80d42d4 100644 --- a/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows.md +++ b/docs/zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_Windows.md @@ -1,4 +1,4 @@ -# M5Core 上手指南(Windows, Arudino) +# Core 上手指南(Windows, Arudino) ?> 如果你的操作系统是MacOS的话,请点击[这里](zh_CN/quick_start/m5core/m5stack_core_get_started_Arduino_MacOS)。 diff --git a/docs/zh_CN/quick_start/m5core/m5stick_get_started_arduino.md b/docs/zh_CN/quick_start/m5core/m5stick_get_started_arduino.md index 11a4bcde..8dbc7c91 100644 --- a/docs/zh_CN/quick_start/m5core/m5stick_get_started_arduino.md +++ b/docs/zh_CN/quick_start/m5core/m5stick_get_started_arduino.md @@ -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一样的环境搭建步骤中。 | ---|--- diff --git a/docs/zh_CN/unit/adc.md b/docs/zh_CN/unit/adc.md index fd4b7089..91e50d23 100644 --- a/docs/zh_CN/unit/adc.md +++ b/docs/zh_CN/unit/adc.md @@ -4,11 +4,13 @@ *** -:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      :electric_plug:**[原理图](#原理图)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.37.3a93425e5PQbBs&id=580131730176)** +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](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 +#include +#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 + + + + + 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/UIFlow)。 @@ -83,6 +61,6 @@ void loop() { ### 管脚映射 - - + +
M5Core(GROVE A)GPIO36GPIO265VGND
BUTTON UnitGPIO36GPIO265VGND
M5Core(GROVE接口B)GPIO36GPIO265VGND
单按键Unit按键引脚 5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/dac.md b/docs/zh_CN/unit/dac.md index a3c19eb5..492d8c70 100644 --- a/docs/zh_CN/unit/dac.md +++ b/docs/zh_CN/unit/dac.md @@ -4,11 +4,13 @@ *** -:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      :electric_plug:**[原理图](#原理图)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.28.312f425eRDFbqp&id=580257615943)** +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.28.312f425eRDFbqp&id=580257615943)** + + ## 描述 -DAC是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是MCP4725,并且不带EEPROM。 +DAC是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。 ## 特性 @@ -33,7 +35,9 @@ ## 例程 ### 1. Arduino IDE - - -### 2. UIFlow + ## 描述 @@ -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 -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 - + + + 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DUAL_BUTTON/UIFlow)。 -## 原理图 + ### 管脚映射 - - + +
M5Core(GROVE B)GPIO36GPIO265VGND
DUAL_BUTTON UnitGPIO36GPIO265VGND
M5Core(GROVE接口B)GPIO36GPIO265VGND
双按键Unit蓝色按键引脚红色按键引脚5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/env.md b/docs/zh_CN/unit/env.md index c180d224..5db709e2 100644 --- a/docs/zh_CN/unit/env.md +++ b/docs/zh_CN/unit/env.md @@ -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 +#include "DHT12.h" +#include //The DHT12 uses I2C comunication. +#include +#include +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 diff --git a/docs/zh_CN/unit/ir.md b/docs/zh_CN/unit/ir.md index c520b3d7..9c78d05f 100644 --- a/docs/zh_CN/unit/ir.md +++ b/docs/zh_CN/unit/ir.md @@ -29,44 +29,25 @@ ### 1. Arduino IDE +*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/IR/Arduino)。* + ```arduino #include -// 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 @@ -81,5 +62,5 @@ void loop() { - +
M5Core(GROVE B)GPIO36GPIO265VGND
IR UnitReceiver PinTransmitter Pin5VGND
红外对管Unit红外接收器引脚红外发送器引脚5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/pir.md b/docs/zh_CN/unit/pir.md index a17b0667..4307a19e 100644 --- a/docs/zh_CN/unit/pir.md +++ b/docs/zh_CN/unit/pir.md @@ -24,19 +24,24 @@ ## 例程 - - ### 2. UIFlow @@ -51,5 +56,5 @@ float pressure = bme.readPressure();//pressure - +
M5Core(GROVE B)GPIO36GPIO265VGND
PIR UnitGPIO36GPIO265VGND
人体红外感应Unit红外感应引脚 5VGND
\ No newline at end of file