diff --git a/docs/assets/img/product_pics/unit/M5GO_Unit_makey_03.png b/docs/assets/img/product_pics/unit/M5GO_Unit_makey_03.png new file mode 100644 index 00000000..f4d51102 Binary files /dev/null and b/docs/assets/img/product_pics/unit/M5GO_Unit_makey_03.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/MAKEY/example_unit_makey_01.png b/docs/assets/img/product_pics/unit/unit_example/MAKEY/example_unit_makey_01.png new file mode 100644 index 00000000..0653885b Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/MAKEY/example_unit_makey_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_en.png b/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_en.png new file mode 100644 index 00000000..f89c32de Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_en.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_zh_CN.png b/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_zh_CN.png new file mode 100644 index 00000000..e2604807 Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_zh_CN.png differ diff --git a/docs/assets/img/product_pics/unit/unit_gps_grove_c.png b/docs/assets/img/product_pics/unit/unit_gps_grove_c.png new file mode 100644 index 00000000..de522e05 Binary files /dev/null and b/docs/assets/img/product_pics/unit/unit_gps_grove_c.png differ diff --git a/docs/en/unit/gps.md b/docs/en/unit/gps.md new file mode 100644 index 00000000..05af876e --- /dev/null +++ b/docs/en/unit/gps.md @@ -0,0 +1,102 @@ +# GPS - 北斗导航 + + + + +*** + +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.13.51a6425e6lnUwE&id=583664452054)** + + + +## 描述 + +GPS是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,比如中国的BDS, 美国的GPS, 俄罗斯的GLONASS等,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。 + +GPSwith AT6558 inside which is created and developed by a Chinese Company named Zhongkewei. AT6558 is capable of highly performance,supportting many types of satellite navigation system, such as China BDS , USA GPS, and Russia GLONASS etc. It is capable of receiving GNSS signal from 6 satellite navigation system, and capable of joint location ,navigation,and timing . Therefore the module is able to obtain accurate global location information . You can connect it to M5Core port C with GROVE cable, and develope it with UART communication. Regards to the gps Unit , a signal amplifying chip is integrated inside . + +## 特性 + +- 支持多种卫星导航系统,比如中国的BDS, 美国的GPS, 俄罗斯的GLONASS等 +- AT6558 + - 15mA超低功耗 (15mA Ultra low power comsume) + - 集成射频、基带、flash (integrated radio frequency,base band, flash) + - 工作温度:-40~85℃ (working temperature) + +- Unit内置两个Lego插件孔,方便与Lego件结合 (With two Lego plugin holes on the Unit, it could be more easier to compatable with Lego mountings ) + +## 应用 + +- 车载定位(Vehicle location) +- 智能执法定位(Intelligent Law enforcement location) + +## 相关链接 + +- **[官方频道视频](https://i.youku.com/i/UNjE1ODA2MzE0OA==?spm=a2hzp.8253869.0.0)** + +- **[官方论坛](http://forum.m5stack.com/)** + +- **[数据手册]** - [AT6558](http://www.icofchina.com/d/file/xiazai/2016-12-05/b1be6f481cdf9d773b963ab30a2d11d8.pdf) - [MAX2659](https://datasheets.maximintegrated.com/en/ds/MAX2659.pdf) + +- **[CASIC多模卫星导航接收机协议规范](http://www.icofchina.com/d/file/xiazai/2017-05-02/ea0cdd3d81eeebcc657b5dbca80925ee.pdf)** + +- **[上位机软件GnssToolKit3(Windows版本)](http://www.icofchina.com/d/file/xiazai/2018-05-23/2b29a8da746eec0ef1dcd9deae895298.zip)** + +## 例程 + +### 1. Arduino IDE + +*例程完整* + +```arduino +#include + +/* By default, GPS is connected with M5Core through UART2 */ +HardwareSerial GPSRaw(2); + +void setup() { + M5.begin(); + GPSRaw.begin(9600);// GPS init + Serial.println("hello"); + termInit(); +} + +void loop() { + // put your main code here, to run repeatedly: + if(Serial.available()) { + int ch = Serial.read(); + GPSRaw.write(ch); + } + if(GPSRaw.available()) { + int ch = GPSRaw.read();// read GPS information + Serial.write(ch); + termPutchar(ch); + } +} +``` + +烧录例程`GPSRaw.ino`之后,屏幕和串口显示终端会打印如下类似的信息 + +``` +$GPGSA,A,1,,,,,,,,,,,,,25.5,25.5,25.5*02 +$BDGSA,A,1,,,,,,,,,,,,,25.5,25.5,25.5*13 +$GPGSV,1,1,00*79 +$BDGSV,1,1,00*68 +$GNRMC,,V,,,,,,,,,,M*4E +$GNVTG,,,,,,,,,M*2D +$GNZDA,,,,,,*56 +$GPTXT,01,01,01,ANTENNA OPEN*25 +``` + +具体例程`GPSRaw.ino`请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/GPS/Arduino)。 + + + +### 管脚映射 + + + + +
M5Core(GROVE接口C)ESP32串口2接收引脚U2RXD(GPIO16)ESP32串口2发送引脚U2TXD(GPIO17)5VGND
北斗导航Unit信号发送引脚TXD信号接收引脚RXD5VGND
diff --git a/docs/en/unit/makey.md b/docs/en/unit/makey.md index f243a458..f769665c 100644 --- a/docs/en/unit/makey.md +++ b/docs/en/unit/makey.md @@ -1,10 +1,12 @@ # Unit MAKEY - + *** -:memo:**[Description](#Description)**      :octocat:**[Example](#Example)**       :electric_plug:**[Schematic](#Schematic)**       🛒**[Purchase](https://www.aliexpress.com/store/product/M5Stack-Official-Makey-Unit-MEGA328P-Inside-16Key-Fruit-Paino-with-NEO-Pixel-and-BUZZER-for-ESP32/3226069_32924883456.html?spm=a2g1y.12024536.productList_5885013.subject_23)** +:memo:**[Description](#Description)**      :octocat:**[Example](#Example)**       🛒**[Purchase](https://www.aliexpress.com/store/product/M5Stack-Official-Makey-Unit-MEGA328P-Inside-16Key-Fruit-Paino-with-NEO-Pixel-and-BUZZER-for-ESP32/3226069_32924883456.html?spm=a2g1y.12024536.productList_5885013.subject_23)** + + ## Description @@ -31,17 +33,33 @@ The Unit makey is a makey unit with 16 touchable pins.The Unit makey is based on ## Example - + -## Schematic + ### PinMap diff --git a/docs/index.md b/docs/index.md index e721bc7e..247ad8d6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -74,12 +74,12 @@ -[![unit_rgb.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_rgb_01.png)](en/unit/rgb)         [![unit_relay.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_relay_01.png)](en/unit/relay) +[![unit_rgb.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_rgb_01.png)](en/unit/rgb)         [![unit_relay.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_relay_01.png)](en/unit/relay)         [![unit_hub.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_hub_01.png)](en/unit/hub)         [![unit_3.96.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_396port_01.png)](en/unit/396port) -[![unit_hub.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_hub_01.png)](en/unit/hub)         [![unit_3.96.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_396port_01.png)](en/unit/396port)         [![unit_proto.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_proto_01.png)](en/unit/proto) +[![unit_proto.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_proto_01.png)](en/unit/proto)         [![unit_gps.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_gps_01.png)](en/unit/gps) *** diff --git a/docs/zh_CN/module/plus.md b/docs/zh_CN/module/plus.md index 6248416d..4b959a19 100644 --- a/docs/zh_CN/module/plus.md +++ b/docs/zh_CN/module/plus.md @@ -49,8 +49,7 @@ void setup() { M5.begin(true, false, false); Wire.begin(); - ledcSetup(1, 38000, 10); - ledcAttachPin(IrPin, 1); + ledcSetup(1, 38000, 10); ledcAttachPin(IrPin, 1);// IR Pin setting } void plus_encode() { @@ -60,7 +59,7 @@ void plus_encode() { uint8_t press_n = Wire.read(); number += encode; if(press_n == 0xff) { - press = 0; + press = 0;//encoder was pressed } else { press = 1; diff --git a/docs/zh_CN/module/stepmotor.md b/docs/zh_CN/module/stepmotor.md index 54574a8d..8807bf3d 100644 --- a/docs/zh_CN/module/stepmotor.md +++ b/docs/zh_CN/module/stepmotor.md @@ -41,7 +41,7 @@ *以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/stepmotor_module/tree/master/Example/Arduino)。* -```adrduino + + +```adrduino +/* + If Button A was pressed, + stepmotor will rotate back and forth at a time +*/ + +#include +#include + +#define STEPMOTOR_I2C_ADDR 0x70 + +M5.begin(); +Wire.begin(); + +// Protocol: +// G XYZ F +SendCommand(STEPMOTOR_I2C_ADDR, "G1 X20Y20Z20 F500"); +SendCommand(STEPMOTOR_I2C_ADDR, "G1 X0Y0Z0 F400"); + +// Get Data from Module. +Wire.requestFrom(STEPMOTOR_I2C_ADDR, 1); +if (Wire.available() > 0) { + int u = Wire.read(); + if (u != 0) Serial.write(u); +} + +// Send Data to Module. +while (Serial.available() > 0) { + int inByte = Serial.read(); + SendByte(STEPMOTOR_I2C_ADDR, inByte); +} ``` ### 2. UIFlow diff --git a/docs/zh_CN/unit/adc.md b/docs/zh_CN/unit/adc.md index 91e50d23..6f3e6823 100644 --- a/docs/zh_CN/unit/adc.md +++ b/docs/zh_CN/unit/adc.md @@ -38,51 +38,34 @@ ### 1. Arduino IDE -*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ADC/Arduino)。* +*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/ADC_ADS1100)。* ```arduino #include #include #include "ADS1100.h" -ADS1100 ads;//new a object -void setup(void) -{ - M5.begin(true, false, false); +// declaration +byte error; +int8_t address; - //The address can be changed making the option of connecting multiple devices - ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);// 0x48, 1001 000 (ADDR = GND) +//new a object +ADS1100 ads; - // 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) +// initialization +M5.begin(true, false, false); +ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);// 0x48, 1001 000 (ADDR = GND) +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(); - 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); -} +// read data +address = ads.ads_i2cAddress; +Wire.beginTransmission(address); +Wire.endTransmission(); +ads.Measure_Differential(); ``` diff --git a/docs/zh_CN/unit/angle.md b/docs/zh_CN/unit/angle.md index 37fdf329..32a6bcd3 100644 --- a/docs/zh_CN/unit/angle.md +++ b/docs/zh_CN/unit/angle.md @@ -4,7 +4,9 @@ *** -:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      :electric_plug:**[原理图](#原理图)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.40.312f425eRDFbqp&id=578201949805)** +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.40.312f425eRDFbqp&id=578201949805)** + + ## 描述 @@ -29,18 +31,19 @@ ANGLE是一个电位器Unit,通过这个Unit可以检测手动旋转的角度. ```arduino #include + // select the input pin for the potentiometer -int sensorPin = 36; +#define sensorPin 36 -void setup() { - M5.begin(); - pinMode(sensorPin, INPUT); -} +// declaration +int cur_sensorValue = 0; -void loop() { - // read the value from the sensor: - cur_sensorValue = analogRead(sensorPin); -} +// initialization +M5.begin(); +pinMode(sensorPin, INPUT); + +// read data +cur_sensorValue = analogRead(sensorPin); ``` ### 2. UIFlow @@ -49,7 +52,7 @@ void loop() { 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/UIFlow)。 -## 原理图 + diff --git a/docs/zh_CN/unit/button.md b/docs/zh_CN/unit/button.md index 84593a20..b58eb885 100644 --- a/docs/zh_CN/unit/button.md +++ b/docs/zh_CN/unit/button.md @@ -30,17 +30,16 @@ BUTTON是一个单按键unit,这个Unit能检测你是否按下了. ```arduino #include -void setup() { - M5.begin();// init - Serial.begin(115200); - pinMode(36, INPUT);// BUTTON Pin -} +// declaration +int cur_value = 0; -void loop() { - cur_value = digitalRead(36);// read the value of BUTTON - Serial.println(cur_value); - M5.update(); -} +// initialization +M5.begin();// init +pinMode(36, INPUT);// BUTTON Pin + +// read data +cur_value = digitalRead(36);// read the value of BUTTON +M5.update(); ``` diff --git a/docs/zh_CN/unit/color.md b/docs/zh_CN/unit/color.md index e41481b0..fa915fb8 100644 --- a/docs/zh_CN/unit/color.md +++ b/docs/zh_CN/unit/color.md @@ -40,16 +40,22 @@ Color是一个颜色传感器. 通过GROVE接口(I2C)与M5Core相连,能够识 please install the Adfruit TCS34725 library first ... */ - #include #include #include "Adafruit_TCS34725.h" +// declaration +uint16_t clear, red, green, blue; // set to false if using a common cathode LED #define commonAnode true // our RGB -> eye-recognized gamma color byte gammatable[256]; +// new a object +Adafruit_TCS34725 tcs; +tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,TCS34725_GAIN_4X); + +// other function static uint16_t color16(uint16_t r, uint16_t g, uint16_t b) { uint16_t _color; _color = (uint16_t)(r & 0xF8) << 8; @@ -58,50 +64,20 @@ static uint16_t color16(uint16_t r, uint16_t g, uint16_t b) { return _color; } -Adafruit_TCS34725 tcs; -tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,TCS34725_GAIN_4X); +// initialization +M5.begin(true, false, false); +tcs.begin(); +tcs.setIntegrationTime(TCS34725_INTEGRATIONTIME_154MS); +tcs.setGain(TCS34725_GAIN_4X); -void setup() { - delay(100); - - M5.begin(true, false, false); - Serial.begin(115200); - Serial.println("Color View Test!"); - - if (tcs.begin()) { - Serial.println("Found sensor"); - } else { - Serial.println("No TCS34725 found ... check your connections"); - while (1); // halt! - } - tcs.setIntegrationTime(TCS34725_INTEGRATIONTIME_154MS); - tcs.setGain(TCS34725_GAIN_4X); -} - -void loop() { - uint16_t clear, red, green, blue; - - delay(60); // takes 50ms to read - - tcs.getRawData(&red, &green, &blue, &clear); - - Serial.print("C:\t"); Serial.print(clear); - Serial.print("\tR:\t"); Serial.print(red); - Serial.print("\tG:\t"); Serial.print(green); - Serial.print("\tB:\t"); Serial.print(blue); - - // Figure out some basic hex code for visualization - uint32_t sum = clear; - float r, g, b; - r = red; r /= sum; - g = green; g /= sum; - b = blue; b /= sum; - r *= 256; g *= 256; b *= 256; - Serial.print("\t"); - Serial.print((int)r,HEX); Serial.print((int)g,HEX); Serial.println((int)b,HEX); - uint16_t _color = color16((int)r, (int)g, (int)b); - M5.Lcd.clear(_color); -} +// read data +tcs.getRawData(&red, &green, &blue, &clear); +// Figure out some basic hex code for visualization +uint32_t sum = clear; +float r, g, b; +r = red; r /= sum; g = green; g /= sum; b = blue; b /= sum; +r *= 256; g *= 256; b *= 256; +uint16_t _color = color16((int)r, (int)g, (int)b); ``` 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/COLOR/Arduino)。 diff --git a/docs/zh_CN/unit/dac.md b/docs/zh_CN/unit/dac.md index 492d8c70..0ad6b5ca 100644 --- a/docs/zh_CN/unit/dac.md +++ b/docs/zh_CN/unit/dac.md @@ -46,22 +46,18 @@ #include #include -#define DAC_ADDR +// new a object Adafruit_MCP4725 dac; -void setup(void) { - dac.begin(0x60); +// initialization +dac.begin(0x60); +dac.setVoltage(2048, false); - dac.setVoltage(2048, false); -} - -void loop(void) { - // 12bit value , false mean not write EEPROM - dac.setVoltage(1024, false);// input digital value "1024" - delay(1000); - dac.setVoltage(2048, false);// input digital value "2048" - delay(1000); -} +// 12bit value , false mean not write EEPROM +dac.setVoltage(1024, false);// input digital value "1024" to unit +delay(1000); +dac.setVoltage(2048, false);// input digital value "2048" to unit +delay(1000); ``` diff --git a/docs/zh_CN/unit/dual_button.md b/docs/zh_CN/unit/dual_button.md index f29c0ac3..6e515cc9 100644 --- a/docs/zh_CN/unit/dual_button.md +++ b/docs/zh_CN/unit/dual_button.md @@ -32,20 +32,19 @@ ```arduino #include -void setup() { - M5.begin();// init - Serial.begin(115200); - pinMode(26, INPUT);// Red Button Pin - pinMode(36, INPUT);// Blue Button Pin -} +// declaration +int cur_value_red = 0; +int cur_value_blue = 0; -void loop() { - cur_value_red = digitalRead(26); - cur_value_blue = digitalRead(36); - Serial.print(cur_value_red); - Serial.println(cur_value_blue); - M5.update(); -} +// initialization +M5.begin(); +pinMode(26, INPUT);// Red Button Pin setting +pinMode(36, INPUT);// Blue Button Pin setting + +// read data +cur_value_red = digitalRead(26); +cur_value_blue = digitalRead(36); +M5.update(); ``` ### 2. UIFlow diff --git a/docs/zh_CN/unit/env.md b/docs/zh_CN/unit/env.md index 5db709e2..239ad170 100644 --- a/docs/zh_CN/unit/env.md +++ b/docs/zh_CN/unit/env.md @@ -34,9 +34,34 @@ ### 1. Arduino IDE -*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ENV/Arduino)。* +*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/ENV)。* ```arduino +/* + Install Adafruit BMP280 Library first. +*/ +#include +#include "DHT12.h" +#include //The DHT12 uses I2C comunication. +#include +#include + +// new two objects +DHT12 dht12; +Adafruit_BMP280 bme; + +// initialization +M5.begin(); +Wire.begin(); +bme.begin(); + +// read data +float tmp = dht12.readTemperature(); +float hum = dht12.readHumidity(); +float pressure = bme.readPressure(); +``` + + ### 2. UIFlow @@ -75,6 +100,6 @@ void loop() { ### 管脚映射 - - + +
M5Core(GROVE A)GPIO22GPIO215VGND
ENV UnitSCLSDA5VGND
M5Core(GROVE接口A)GPIO22GPIO215VGND
ENV温湿度和压力传感器UnitSCLSDA5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/gps.md b/docs/zh_CN/unit/gps.md index a20ac09b..1313c9f9 100644 --- a/docs/zh_CN/unit/gps.md +++ b/docs/zh_CN/unit/gps.md @@ -1,7 +1,6 @@ # GPS - 北斗导航 - - + *** @@ -11,7 +10,7 @@ ## 描述 -GPS是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,比如中国的BDS, 美国的GPS, 俄罗斯的GLONASS等,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。 +GPS是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。 ## 特性 @@ -44,8 +43,6 @@ ### 1. Arduino IDE -*例程完整* - ```arduino #include diff --git a/docs/zh_CN/unit/ir.md b/docs/zh_CN/unit/ir.md index 935c0388..f815f0ae 100644 --- a/docs/zh_CN/unit/ir.md +++ b/docs/zh_CN/unit/ir.md @@ -34,18 +34,17 @@ ```arduino #include -void setup() { - M5.begin(); - 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);// send infrared light -} +// declaration +int cur_recv_value = 0; -void loop() { - cur_recv_value = digitalRead(ir_recv_pin);// read the status of receiver -} +// initialization +M5.begin(); +pinMode(ir_recv_pin, INPUT);// receiver pin +pinMode(ir_send_pin, OUTPUT);// transmitter pin +digitalWrite(ir_send_pin, 1);// send infrared light + +// read data +cur_recv_value = digitalRead(ir_recv_pin);// read the status of receiver ``` ### 2. UIFlow @@ -61,6 +60,6 @@ void loop() { ### 管脚映射 - +
M5Core(GROVE B)GPIO36GPIO265VGND
M5Core(GROVE接口B)GPIO36GPIO265VGND
红外对管Unit红外接收器引脚红外发送器引脚5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/joystick.md b/docs/zh_CN/unit/joystick.md index 748ed139..a321de69 100644 --- a/docs/zh_CN/unit/joystick.md +++ b/docs/zh_CN/unit/joystick.md @@ -34,41 +34,35 @@ Joystick Unit同样也是与M5Core相连之后,通过PORT A(I2C)控制,其I2 ### 1. Arduino IDE -*例程完整* +*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/JOYSTICK/Arduino)。* ```arduino #include #include "Wire.h" #define JOY_ADDR 0x52 -void setup() { - M5.begin(); - M5.Lcd.clear(); - //disable the speak noise - dacWrite(25, 0); - Wire.begin(21, 22, 400000); -} - -uint8_t x_data; -uint8_t y_data; -uint8_t button_data; +// declaration +uint8_t x_data, y_data, button_data; char data[100]; -void loop() { - Wire.requestFrom(JOY_ADDR, 3); - if (Wire.available()) { - x_data = Wire.read();// X(range: 10~250) - y_data = Wire.read();// Y(range: 10~250) - button_data = Wire.read();// Z(0: released 1: pressed) - sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data); - Serial.print(data); - } - delay(200); + +// initialization +M5.begin(); +M5.Lcd.clear(); +dacWrite(25, 0);//disable the speak noise +Wire.begin(21, 22, 400000); + + +// read data +Wire.requestFrom(JOY_ADDR, 3); +if (Wire.available()) { + x_data = Wire.read();// X(range: 10~250) + y_data = Wire.read();// Y(range: 10~250) + button_data = Wire.read();// Z(0: released 1: pressed) + sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data); } ``` -具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/JOYSTICK/Arduino)。 - ### 2. UIFlow diff --git a/docs/zh_CN/unit/light.md b/docs/zh_CN/unit/light.md index df2bf180..839a1715 100644 --- a/docs/zh_CN/unit/light.md +++ b/docs/zh_CN/unit/light.md @@ -10,7 +10,7 @@ LIGHT是一款光线传感器,内置光敏电阻和10K的可调电阻,可以通过调节可调电阻,从而改变触发信号的光强阈值。Unit的GRVE接口可以输出数字信号或者光强对应的模拟信号(电压信号)。 -LIGHT在光强弱的时候,数字引脚输出高电平,即数字信号"1",否则输出"0"。 +LIGHT在光照强度弱的时候,数字引脚输出高电平,即数字信号"1",否则输出"0"。 ## 特性 @@ -34,21 +34,18 @@ LIGHT在光强弱的时候,数字引脚输出高电平,即数字信号"1", ```arduino #include -void setup() { - M5.begin(); - dacWrite(25, 0);// disable the speak noise - - pinMode(26, INPUT);// set LIGHT Pin -} - +// declaration uint16_t analogRead_value = 0; uint16_t digitalRead_value = 0; -void loop() { - analogRead_value = analogRead(36);// read analog value of LIGHT - digitalRead_value = digitalRead(26); - delay(10); -} +// initialization +M5.begin(); +dacWrite(25, 0);// disable the speak noise +pinMode(26, INPUT);// LIGHT Pin setting + +// read data +analogRead_value = analogRead(36);// read analog value of LIGHT +digitalRead_value = digitalRead(26); ``` ### 2. UIFlow @@ -64,6 +61,6 @@ void loop() { ### 管脚映射 - +
M5Core(GROVE B)GPIO36GPIO265VGND
M5Core(GROVE接口B)GPIO36GPIO265VGND
光线传感Unit模拟值输出引脚数字值输出引脚5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/makey.md b/docs/zh_CN/unit/makey.md index 0a3a8a3d..dfdb8714 100644 --- a/docs/zh_CN/unit/makey.md +++ b/docs/zh_CN/unit/makey.md @@ -1,15 +1,27 @@ # MAKEY - 创意键盘 - + *** -:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      :electric_plug:**[原理图](#原理图)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.51.159c425eoqBTTY&id=577636777112)** +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.51.159c425eoqBTTY&id=577636777112)** + + ## 描述 MAKEY是一款自带16引脚的Makey Unit,不过比市面上的Makey模块更容易编程,因为该Unit内置了MEGA328芯片来处理触摸引脚产生的信号。该Unit同样也是与M5Core相连之后,通过PORT A(I2C)控制,其I2C地址是0x51。 +**使用方法:** + +1)只是unit上的蜂鸣器发声 + +一根杜邦线或普通导线接unit的GND孔,并另一端被握在左手;另一根杜邦线一端握右手,另一端触碰unit上的音调孔,就会发出对应音调。 + +2)m5core上的喇叭发声 + +unit通过GROVE线连接至m5core的接口A后,烧录[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/MAKEY/Arduino),一根杜邦线或普通导线接unit的GND孔,并另一端被握在左手;另一根杜邦线一端握右手,另一端触碰unit上的音调孔,m5core的喇叭会发出对应音调。 + ## 特性 - 内置Mega328p芯片,蜂鸣器,RGBLed @@ -29,32 +41,43 @@ ## 例程 - +具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/MAKEY/UIFlow)。 -## 原理图 + ### 管脚映射 - - + +
M5Core(GROVE A)GPIO22GPIO215VGND
MAKEY UnitSCLSDA5VGND
M5Core(GROVE接口A)GPIO22GPIO215VGND
MAKEY创意键盘UnitSCLSDA5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/ncir.md b/docs/zh_CN/unit/ncir.md index 3f516380..4cc59532 100644 --- a/docs/zh_CN/unit/ncir.md +++ b/docs/zh_CN/unit/ncir.md @@ -4,11 +4,13 @@ *** -:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      :electric_plug:**[原理图](#原理图)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.43.3a93425e5PQbBs&id=580005645359)** +:memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.43.3a93425e5PQbBs&id=580005645359)** + + ## 描述 -NCIR是一款可以测量人体体温和人体走动的Unit,它内置了**MLX90641传感器**。它与Thermal Unit的区别,主要是NCIR Unit做表面单点温度测量,而Thermal Unit做大面积范围的温度测量。 +NCIR是一款可以测量人体或者其他物体表面温度的Unit,它内置了**MLX90614传感器**。它与Thermal Unit的区别,主要是NCIR Unit做表面单点温度测量,而Thermal Unit做大面积范围的温度测量。该Unit与m5core通过IIC通信,IIC地址为0x5A。 ## 特性 @@ -30,22 +32,37 @@ - **数据手册** - [MLX90614](https://pdf1.alldatasheet.com/datasheet-pdf/view/218977/ETC2/MLX90614.html) - +## 例程 - -## 原理图 + - + ### 管脚映射 - - + +
M5Core(GROVE B)GPIO36GPIO265VGND
RGB UnitGPIO36GPIO265VGND
M5Core(GROVE接口B)GPIO36GPIO265VGND
RGB Unit 信号引脚5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/thermal.md b/docs/zh_CN/unit/thermal.md index d4638305..8307e086 100644 --- a/docs/zh_CN/unit/thermal.md +++ b/docs/zh_CN/unit/thermal.md @@ -1,4 +1,4 @@ -# THERMAL - 人体红外成像Unit +**# THERMAL - 人体红外成像Unit @@ -8,9 +8,9 @@ ## 描述 -Thermal是一款内置热电堆传感器(一种热释红外传感器,型号MLX90640)的Unit,可以用了测量物体表面温度,并由各个表面温度不同组成的温度梯度而形成热成像图。MLX90640的像素是32x64。 +Thermal是一款内置热电堆传感器(一种热释红外传感器,型号**MLX90640**)的Unit,可以用了测量物体表面温度,并由各个表面温度不同组成的温度梯度而形成热成像图。MLX90640的像素是32x24。 -该Unit同样与M5Core通过PORT A(I2C)接口通信。 +该Unit同样与M5Core通过PORT A(I2C)接口通信。IIC地址为0x33。 使用该Unit可以方便的测量各个物体表面温度(正常误差±1.5°C) @@ -18,7 +18,7 @@ ## 特性 - 32x24像素 -- 目标温度:-40°C ÷ 300°C +- 目标温度:-40°C ~ 300°C - GROVE接口,支持[UiFlow](http://flow.m5stack.com)编程,[Arduino](http://www.arduino.cc)编程 - Unit内置两个Lego插件孔,方便与Lego件结合 @@ -64,6 +64,6 @@ float pressure = bme.readPressure();//pressure ### 管脚映射 - +
M5Core(GROVE A)GPIO22GPIO215VGND
M5Core(GROVE接口A)GPIO22GPIO215VGND
THERMAL UnitSCLSDA5VGND
\ No newline at end of file diff --git a/docs/zh_CN/unit/tof.md b/docs/zh_CN/unit/tof.md index d6a1ed0b..b99e3d86 100644 --- a/docs/zh_CN/unit/tof.md +++ b/docs/zh_CN/unit/tof.md @@ -1,4 +1,4 @@ -# TOF - 红外测距Unit +# TOF - 红外激光测距Unit @@ -8,7 +8,7 @@ ## 描述 -ToF是一款用"Time-to-Flight"传感器(VL53L0X)发出940nm的激光来测量距离的Unit,相比其他测距传感器,具有更高的精度,可以直接确定以毫米为单位的目标物体的距离。不到30ms即可提供最长2米的毫米级的绝对距离读值。 +ToF是一款用"Time-to-Flight"传感器(VL53L0X)发出940nm波长的激光来测量距离的Unit,相比其他测距传感器,具有更高的精度,可以直接确定以毫米为单位的目标物体的距离。不到30ms即可提供最长2米的毫米级的绝对距离读值。 该Unit与M5Core通过PORT A(I2C)通信。I2C地址为0x29 @@ -42,17 +42,31 @@ ### 1. Arduino IDE +*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/TOF/Arduino)。* + ```arduino +#include +#include + +#define ToF_ADDR 0x29//the iic address of tof + #define SYSRANGE_START 0x00 #define RESULT_RANGE_STATUS 0x14 #define ToF_ADDR 0x29 //the IIC address of ToF -write_byte_data_at(SYSRANGE_START, 0x01); //start measure -read_block_data_at(RESULT_RANGE_STATUS, 12); //read 12 bytes once -dist = makeuint16(gbuf[11], gbuf[10]); //split distance data and save at "dist" -``` +// declaration +uint16_t dist=0; -具体例程`MeasureDistance.ino`请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/TOF/Arduino)。 +// initialization +M5.begin(); +Wire.begin();// join i2c bus (address optional for master) + +// read data +write_byte_data_at(VL53L0X_REG_SYSRANGE_START, 0x01); +read_block_data_at(VL53L0X_REG_RESULT_RANGE_STATUS, 12);//read 12 bytes once +// get distance +dist = makeuint16(gbuf[11], gbuf[10]);//split distance data to variable "dist" +```