This commit is contained in:
LiHuashen
2018-12-28 17:39:33 +08:00
parent 030e750a8a
commit 92a03509fd
28 changed files with 470 additions and 271 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

+102
View File
@@ -0,0 +1,102 @@
# GPS - 北斗导航
<img src="assets/img/product_pics/unit/unit_gps_01.png" width="30%" height="30%">
<img src="assets/img/product_pics/unit/unit_gps_02.png" width="30%" height="30%">
***
: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.13.51a6425e6lnUwE&id=583664452054)**
<!-- :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.13.51a6425e6lnUwE&id=583664452054)** -->
## 描述
<mark>GPS</mark>是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,比如中国的BDS, 美国的GPS, 俄罗斯的GLONASS等,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。
<mark>GPS</mark>with 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
<!-- - GROVE接口,支持[UiFlow](http://flow.m5stack.com)编程,[Arduino](http://www.arduino.cc)编程 -->
- 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 <M5Stack.h>
/* 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)。
<!-- ## 原理图
<img src="assets/img/product_pics/unit/env_sch.jpg"> -->
### 管脚映射
<table>
<tr><td>M5Core(GROVE接口C)</td><td>ESP32串口2接收引脚U2RXD(GPIO16)</td><td>ESP32串口2发送引脚U2TXD(GPIO17)</td><td>5V</td><td>GND</td></tr>
<tr><td>北斗导航Unit</td><td>信号发送引脚TXD</td><td>信号接收引脚RXD</td><td>5V</td><td>GND</td></tr>
</table>
+27 -9
View File
@@ -1,10 +1,12 @@
# Unit MAKEY
<img src="assets/img/product_pics/unit/M5GO_Unit_makey.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_makey_grove_a.png" width="30%" height="30%">
<img src="assets/img/product_pics/unit/M5GO_Unit_makey.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_makey_grove_a.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/M5GO_Unit_makey_03.png" width="30%" height="30%">
***
:memo:**[Description](#Description)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[Example](#Example)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :electric_plug:**[Schematic](#Schematic)** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[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)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[Example](#Example)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 🛒**[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)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[Example](#Example)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :electric_plug:**[Schematic](#Schematic)** &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[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
<!-- ```arduino
float tmp = dht12.readTemperature();//temperature
float hum = dht12.readHumidity();//humidity
float pressure = bme.readPressure();//pressure
### 1. Arduino IDE
*The below code is incomplete(just for usage). If you want the complete code, please click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/MAKEY/Arduino)*
```arduino
#include <M5Stack.h>
#include <Wire.h>
// initialization
M5.begin();
pinMode(21, INPUT); pinMode(22, INPUT);
Wire.begin();// Init I2C
// read data
Wire.requestFrom(MAKEY_ADDR, 2);
while (Wire.available()) {
Key1 = Wire.read();//read data from MAKEY
Key2 = Wire.read();//read data from MAKEY
tone_key = (Key2<<8) | Key1;// the following picture will explain "tone_key"
}
```
Click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/MAKEY)for Specific example. -->
<img src="assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_en.png">
## Schematic
<!-- ## Schematic
<img src="assets/img/product_pics/unit/makey_sch.JPG">
<img src="assets/img/product_pics/unit/makey_sch.JPG"> -->
### PinMap
+2 -2
View File
@@ -74,12 +74,12 @@
<!-- [![unit_heart.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_heart_01.png)](en/unit/heart) -->
[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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_neopixel.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/assets/img/product_pics/homepage_picture/unit/unit_neopixel_01.png)](en/unit/neopixel) -->
[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![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)
***
+2 -3
View File
@@ -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;
+34 -1
View File
@@ -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
@@ -79,6 +79,39 @@ void loop() {
SendByte(STEPMOTOR_I2C_ADDR, inByte);
}
}
``` -->
```adrduino
/*
If Button A was pressed,
stepmotor will rotate back and forth at a time
*/
#include <M5Stack.h>
#include <Wire.h>
#define STEPMOTOR_I2C_ADDR 0x70
M5.begin();
Wire.begin();
// Protocol:
// G<n> X<distance>Y<distance>Z<distance> F<speed>
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
+19 -36
View File
@@ -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 <M5Stack.h>
#include <Wire.h>
#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();
```
<!-- ### 2. UIFlow -->
+14 -11
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.40.312f425eRDFbqp&id=578201949805)**
: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.40.312f425eRDFbqp&id=578201949805)**
<!-- :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.40.312f425eRDFbqp&id=578201949805)** -->
## 描述
@@ -29,18 +31,19 @@ ANGLE是一个电位器Unit,通过这个Unit可以检测手动旋转的角度.
```arduino
#include <M5Stack.h>
// 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)。
## 原理图
<!-- ## 原理图 -->
<!-- <img src="assets/img/product_pics/unit/angle_sch.JPG"> -->
+9 -10
View File
@@ -30,17 +30,16 @@ BUTTON是一个单按键unit,这个Unit能检测你是否按下了.
```arduino
#include <M5Stack.h>
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();
```
+20 -44
View File
@@ -40,16 +40,22 @@ Color是一个颜色传感器. 通过GROVE接口(I2C)与M5Core相连,能够识
please install the Adfruit TCS34725 library first ...
*/
#include <Wire.h>
#include <M5Stack.h>
#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)。
+9 -13
View File
@@ -46,22 +46,18 @@
#include <Wire.h>
#include <Adafruit_MCP4725.h>
#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);
```
<!-- ### 2. UIFlow -->
+12 -13
View File
@@ -32,20 +32,19 @@
```arduino
#include <M5Stack.h>
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
+29 -4
View File
@@ -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 <M5Stack.h>
#include "DHT12.h"
#include <Wire.h> //The DHT12 uses I2C comunication.
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
// 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();
```
<!-- ```arduino
#include <M5Stack.h>
#include "DHT12.h"
#include <Wire.h> //The DHT12 uses I2C comunication.
@@ -60,7 +85,7 @@ void loop() {
float hum = dht12.readHumidity();
float pressure = bme.readPressure();
}
```
``` -->
### 2. UIFlow
@@ -75,6 +100,6 @@ void loop() {
### 管脚映射
<table>
<tr><td>M5Core(GROVE A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
<tr><td>ENV 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>ENV温湿度和压力传感器Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>
+2 -5
View File
@@ -1,7 +1,6 @@
# GPS - 北斗导航
<img src="assets/img/product_pics/unit/unit_gps_01.png" width="30%" height="30%">
<img src="assets/img/product_pics/unit/unit_gps_02.png" width="30%" height="30%">
<img src="assets/img/product_pics/unit/unit_gps_01.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_gps_02.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_gps_grove_c.png" width="30%" height="30%">
***
@@ -11,7 +10,7 @@
## 描述
<mark>GPS</mark>是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,比如中国的BDS, 美国的GPS, 俄罗斯的GLONASS等,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。
<mark>GPS</mark>是一款集成车载设备级别的中科微北斗导航AT6558的Unit,芯片性能强悍,能获取准确全球位置信息,支持多种卫星导航系统,同时接受六个卫星导航系统的GNSS信号,并且实现联合定位、导航和授时。接M5Core的GROVE C口,M5Core通过串口与该unit通讯。其中unit还集成了信号放大芯片MAX2659。
## 特性
@@ -44,8 +43,6 @@
### 1. Arduino IDE
*例程完整*
```arduino
#include <M5Stack.h>
+11 -12
View File
@@ -34,18 +34,17 @@
```arduino
#include <M5Stack.h>
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() {
### 管脚映射
<table>
<tr><td>M5Core(GROVE B)</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>
+18 -24
View File
@@ -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 <M5Stack.h>
#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
<img src="assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_01.png" width="30%" height="30%"> <img src="assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_02.png" width="58%" height="58%">

Some files were not shown because too many files have changed in this diff Show More