mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add some examples
This commit is contained in:
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
+3
-1
@@ -28,7 +28,9 @@
|
||||
|
||||
[](en/module/lora) [](en/module/lorawan) [](en/module/sim800)
|
||||
|
||||
[](en/module/commu) [](en/module/usb)
|
||||
[](en/module/commu)
|
||||
|
||||
<!-- [](en/module/usb) -->
|
||||
|
||||
<!-- [](en/module/usb) -->
|
||||
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@
|
||||
|
||||
[](ja/module/gps) [](ja/module/lora) [](ja/module/lorawan) [](ja/module/sim800)
|
||||
|
||||
[](ja/module/commu) [](ja/module/usb)
|
||||
[](ja/module/commu)
|
||||
|
||||
<!-- [](ja/module/usb) -->
|
||||
|
||||
<!-- |[GPS]()|[LORA]()|[SIM800/GPRS/GSM]()|[COMMU]()| -->
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
***
|
||||
|
||||
:memo:**[描述](#描述)** :octocat:**[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Base/LAN/Arduino)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.10.6c24425eKdAPr3&id=574863427657)**
|
||||
:memo:**[描述](#描述)** :octocat:**[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Base/LAN/Arduino)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.10.6c24425eKdAPr3&id=574863427657)**
|
||||
|
||||
<!-- :memo:**[描述](#描述)** :octocat:**[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Base/LAN/Arduino)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.10.6c24425eKdAPr3&id=574863427657)** -->
|
||||
|
||||
## 描述
|
||||
|
||||
@@ -46,4 +48,4 @@
|
||||
|
||||
- **[官方论坛](http://forum.m5stack.com/)**
|
||||
|
||||
## 原理图
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
|
||||
***
|
||||
|
||||
:memo:**[描述](#描述)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-1172588093.64.501375f4xEgd84&id=562045689464)**
|
||||
:memo:**[描述](#描述)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-1172588093.64.501375f4xEgd84&id=562045689464)**
|
||||
|
||||
<!-- :memo:**[描述](#描述)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-1172588093.64.501375f4xEgd84&id=562045689464)** -->
|
||||
|
||||
# 描述
|
||||
|
||||
BATTERY模块是一款850mAh的高容量电池模块。当M5Core堆叠了这个电池模块之后,可以做成移动的设备,不再需要USB线一直供电。
|
||||
BATTERY模块是一款**850mAh**的高容量电池模块。当M5Core堆叠了这个电池模块之后,可以做成移动的设备,不再需要USB线一直供电。
|
||||
|
||||
# 特性
|
||||
|
||||
@@ -24,4 +26,4 @@ BATTERY模块是一款850mAh的高容量电池模块。当M5Core堆叠了这个
|
||||
|
||||
- **[官方论坛](http://forum.m5stack.com/)**
|
||||
|
||||
## 原理图
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
@@ -27,6 +27,18 @@
|
||||
|
||||
- **[官方论坛](http://forum.m5stack.com/)**
|
||||
|
||||
<!-- - **[模块内MEGA328固件]()** -->
|
||||
|
||||
## 例程
|
||||
|
||||
## 原理图
|
||||
### 1. Arduino IDE
|
||||
|
||||
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
<img src="assets/img/product_pics/module/module_example/LEGO_PLUS/example_module_lego_plus_01.png" width="40%" height="40%"> <img src="assets/img/product_pics/module/module_example/LEGO_PLUS/example_module_lego_plus_02.png" width="45%" height="45%">
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LEGO_PLUS/UIFlow)。
|
||||
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
+40
-13
@@ -4,7 +4,9 @@
|
||||
|
||||
***
|
||||
|
||||
:memo:**[描述](#描述)** :octocat:**[例程](#原理图)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.6e32425el3pHvc&id=579821616764)**
|
||||
:memo:**[描述](#描述)** :octocat:**[例程](#例程)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.6e32425el3pHvc&id=579821616764)**
|
||||
|
||||
<!-- :memo:**[描述](#描述)** :octocat:**[例程](#原理图)** :electric_plug:**[原理图](#原理图)** 🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.11.6e32425el3pHvc&id=579821616764)** -->
|
||||
|
||||
## 描述
|
||||
|
||||
@@ -31,23 +33,48 @@
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*以下仅为用法示意,并不完整。如果需要完整例程`plus_read_encoder.ino`请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/PLUS/Arduino)。*
|
||||
|
||||
|
||||
```arduino
|
||||
/*
|
||||
* 读取齿轮电位器的数据
|
||||
* 读取齿轮电位器的数据和发送红外光线
|
||||
*/
|
||||
Wire.requestFrom(0x62, 2);
|
||||
#include <Arduino.h>
|
||||
#include <M5Stack.h>
|
||||
|
||||
if(Wire.available()) {
|
||||
encode = Wire.read();//read value of encoder
|
||||
if(press_n == 0xff) {
|
||||
pressed = 0;//button released
|
||||
}
|
||||
else {
|
||||
pressed = 1;//button pressed
|
||||
#define IrPin 13
|
||||
#define PLUS_ADDR 0x62
|
||||
|
||||
void setup() {
|
||||
M5.begin(true, false, false);
|
||||
Wire.begin();
|
||||
ledcSetup(1, 38000, 10);
|
||||
ledcAttachPin(IrPin, 1);
|
||||
}
|
||||
|
||||
void plus_encode() {
|
||||
Wire.requestFrom(PLUS_ADDR, 2);
|
||||
while(Wire.available()) {
|
||||
int8_t encode = Wire.read();
|
||||
uint8_t press_n = Wire.read();
|
||||
number += encode;
|
||||
if(press_n == 0xff) {
|
||||
press = 0;
|
||||
}
|
||||
else {
|
||||
press = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
char data[20];
|
||||
|
||||
plus_encode();
|
||||
ledcWrite(1, ledcRead(1) ? 0 : 512);
|
||||
sprintf(data, "%d %d ", number, press);
|
||||
}
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/PLUS/Arduino)。
|
||||
|
||||
## 原理图
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
@@ -76,5 +76,4 @@ void loop() {
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 原理图
|
||||
<!-- ## 原理图 -->
|
||||
@@ -34,6 +34,8 @@ Joystick Unit同样也是与M5Core相连之后,通过PORT A(I2C)控制,其I2
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*例程完整*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
#include "Wire.h"
|
||||
|
||||
Reference in New Issue
Block a user