add some arduino examples for Units
|
Before Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 419 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -1,6 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
## 描述
|
||||
|
||||
这是带自校准功能的16位模拟数字转换unit,相比ESP32芯片自带的ADC(12位)功能分辨率高了不少,意味着你可以测量更小幅值的电压等模拟量,也就是能测量更细微一倍的模拟量,比如采集心电电压做心电监护项目、做血压监测项目、高精度电压监控项目等等。unit集成的ADC芯片通过I2C接口与M5的主控通讯,可以设置成单周期转换和连续转换方式。
|
||||
这是带自校准功能的16位模拟数字转换unit,相比ESP32芯片自带的ADC(12位)功能分辨率高了不少,意味着你可以测量更小幅值的电压等模拟量,也就是能测量更细微一倍的模拟量,比如采集心电电压做心电监护项目、做血压监测项目、高精度电压监控项目等等。unit集成的ADC芯片通过I2C接口与M5的主控通讯(I2C地址为0x48),可以设置成单周期转换和连续转换方式。
|
||||
|
||||
## 特性
|
||||
|
||||
@@ -34,22 +34,21 @@
|
||||
|
||||
## 例程
|
||||
|
||||
<!-- ### 1. Arduino IDE
|
||||
### 1. Arduino IDE
|
||||
|
||||
```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
ADS1100 ads;//new a object
|
||||
ads.getAddr_ADS1100(0x48);//ADS1100_DEFAULT_ADDRESS: 0x48
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
ads.setOSMode(OSMODE_SINGLE);// Set to start a single-conversion
|
||||
result = ads.Measure_Differential();//Reads the conversion results
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/ADC/Arduino)。
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
<img src="assets/img/product_pics/units/unit_example/example_unit_adc_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_adc_02.png" width="55%" height="55%">
|
||||
<!-- <img src="assets/img/product_pics/units/unit_example/example_unit_adc_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_adc_02.png" width="55%" height="55%">
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/ADC/UIFlow)。 -->
|
||||
|
||||
|
||||
@@ -31,24 +31,29 @@ Color是一个颜色传感器. 通过GROVE接口(I2C)与M5Core相连,能够识
|
||||
|
||||
## 例程
|
||||
|
||||
<!-- ### 1. Arduino IDE
|
||||
### 1. Arduino IDE
|
||||
|
||||
```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
Adafruit_TCS34725 tcs;
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
|
||||
|
||||
tcs.getRawData(&red, &green, &blue, &clear);//get rgb value
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/COLOR_SENSOR/Arduino)。
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/COLOR/Arduino)。
|
||||
|
||||
烧录了例程后,串口显示终端会打印原始值,包括明光感应值(Clear)、红、绿、蓝(RGB)
|
||||
|
||||
下图是感应红色的输出结果
|
||||
|
||||
<img src="assets/img/product_pics/units/unit_example/COLOR/example_unit_color_result_01.png">
|
||||
|
||||
### 2. UIFlow
|
||||
<!--
|
||||
<img src="assets/img/product_pics/units/unit_example/example_unit_color_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_color_02.png" width="55%" height="55%">
|
||||
|
||||
<img src="assets/img/product_pics/units/unit_example/example_unit_color_sensor_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_color_sensor_02.png" width="55%" height="55%">
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/COLOR_SENSOR/UIFlow)。 -->
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/COLOR/UIFlow)。 -->
|
||||
|
||||
## 原理图
|
||||
|
||||
|
||||
@@ -32,22 +32,48 @@
|
||||
|
||||
## 例程
|
||||
|
||||
<!-- ### 1. Arduino IDE
|
||||
|
||||
### 1. Arduino IDE
|
||||
<!--
|
||||
```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
/*
|
||||
hardware : m5stack uint dac
|
||||
please install adafruit MCP4725 lib
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_MCP4725.h>
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
```
|
||||
#define DAC_ADDR
|
||||
Adafruit_MCP4725 dac;
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/DAC/Arduino)。
|
||||
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);
|
||||
delay(1000);
|
||||
dac.setVoltage(2048, false);
|
||||
delay(1000);
|
||||
}
|
||||
``` -->
|
||||
|
||||
<!-- 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/DAC/Arduino)。 -->
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
<img src="assets/img/product_pics/units/unit_example/example_unit_dac_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_dac_02.png" width="55%" height="55%">
|
||||
<!-- <img src="assets/img/product_pics/units/unit_example/example_unit_dac_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_dac_02.png" width="55%" height="55%">
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/DAC/UIFlow)。 -->
|
||||
|
||||
|
||||
@@ -29,16 +29,15 @@ Unit可以输出0/1的数字信号,也可以直接输出被测物体反映的
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
<!-- ```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
```c++
|
||||
//disable the speak noise
|
||||
dacWrite(25, 0);
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
analogRead_value = analogRead(36);
|
||||
digitalRead_value = digitalRead(26);
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/EARTH/Arduino)。 -->
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/EARTH/Arduino)。
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
@@ -54,5 +53,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>EARTH Unit</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>EARTH Unit</td><td>Ain</td><td>Din</td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
@@ -1,6 +1,8 @@
|
||||
# JOYSTICK - 摇杆Unit
|
||||
|
||||
<img src="assets/img/product_pics/units/M5GO_Unit_joystick.png" width="30%" height="30%"><img src="assets/img/product_pics/units/unit_joystick_grove_a.png" width="30%" height="30%">
|
||||
<img src="assets/img/product_pics/units/M5GO_Unit_joystick_01.png" width="30%" height="30%"><img src="assets/img/product_pics/units/M5GO_Unit_joystick_02.png" width="30%" height="30%"><img src="assets/img/product_pics/units/unit_joystick_grove_a.png" width="30%" height="30%">
|
||||
|
||||
<!-- <img src="assets/img/product_pics/units/M5GO_Unit_joystick_03.png" width="30%" height="30%"> -->
|
||||
|
||||
***
|
||||
|
||||
@@ -29,16 +31,22 @@ Joystick Unit同样也是与M5Core相连之后,通过PORT A(I2C)控制,其I2
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
<!-- ```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
```c++
|
||||
#define JOY_ADDR 0x52
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
//disable the speak noise
|
||||
dacWrite(25, 0);
|
||||
Wire.begin(21, 22, 400000);
|
||||
Wire.requestFrom(JOY_ADDR);
|
||||
while(Wire.available())
|
||||
{
|
||||
x_data = Wire.read();//x
|
||||
y_data = Wire.read();//x
|
||||
button_data = Wire.read();//x
|
||||
}
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/JOYSTICK/Arduino)。 -->
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/JOYSTICK/Arduino)。
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
|
||||
@@ -27,16 +27,15 @@
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
<!-- ```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
```c++
|
||||
//disable the speak noise
|
||||
dacWrite(25, 0);
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
float pressure = bme.readPressure();//pressure
|
||||
analogRead_value = analogRead(36);//get analog value of LIGHT(0-4095)
|
||||
digitalRead_value = digitalRead(26);//0: sense the ligth 1: do not sense
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/LIGHT/Arduino)。 -->
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/LIGHT/Arduino)。
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
@@ -52,5 +51,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>LIGHT Unit</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>LIGHT Unit</td><td>Ain</td><td>Din</td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
@@ -8,17 +8,28 @@
|
||||
|
||||
## 描述
|
||||
|
||||
<mark>ToF</mark>是一款用"Time-to-Flight"传感器来测量距离的Unit,相比其他测距传感器,具有更高的精度。
|
||||
<mark>ToF</mark>是一款用"Time-to-Flight"传感器(VL53L0X)发出940nm的激光来测量距离的Unit,相比其他测距传感器,具有更高的精度,可以直接确定以毫米为单位的目标物体的距离。不到30ms即可提供最长2米的毫米级的绝对距离读值。
|
||||
|
||||
该Unit与M5Core通过PORT A(I2C)通信。
|
||||
该Unit与M5Core通过PORT A(I2C)通信。I2C地址为0x29
|
||||
|
||||
## 特性
|
||||
|
||||
- 高精度
|
||||
- 测量距离最大2m
|
||||
- 激光波长: 940nm
|
||||
- GROVE接口,支持[UiFlow](http://flow.m5stack.com)编程,[Arduino](http://www.arduino.cc)编程
|
||||
- Unit内置两个Lego插件孔,方便与Lego件结合
|
||||
|
||||
## 应用
|
||||
|
||||
- 手势控制
|
||||
|
||||
- 激光测距
|
||||
|
||||
- 3D结构光成像(3D感测)
|
||||
|
||||
- 摄像机辅助(超快速自动对焦和景深图)
|
||||
|
||||
## 相关链接
|
||||
|
||||
- **[官方频道视频](https://i.youku.com/i/UNjE1ODA2MzE0OA==?spm=a2hzp.8253869.0.0)**
|
||||
@@ -29,11 +40,10 @@
|
||||
|
||||
## 例程
|
||||
|
||||
<!-- ### 1. Arduino IDE
|
||||
### 1. Arduino IDE
|
||||
|
||||
```c++
|
||||
DHT12 dht12; //new a object
|
||||
Adafruit_BMP280 bme;
|
||||
#define address 0x29
|
||||
|
||||
float tmp = dht12.readTemperature();//temperature
|
||||
float hum = dht12.readHumidity();//humidity
|
||||
@@ -42,7 +52,7 @@ float pressure = bme.readPressure();//pressure
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Units/TOF/Arduino)。
|
||||
|
||||
### 2. UIFlow
|
||||
<!-- ### 2. UIFlow
|
||||
|
||||
<img src="assets/img/product_pics/units/unit_example/example_unit_tof_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/units/unit_example/example_unit_tof_02.png" width="55%" height="55%">
|
||||
|
||||
|
||||