mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add quick start
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
@@ -0,0 +1,112 @@
|
||||
# TOUCH
|
||||
|
||||
## getPressPoint()
|
||||
|
||||
**Description**
|
||||
|
||||
Get touch coordinates
|
||||
|
||||
**Syntax**
|
||||
|
||||
<mark>TouchPoint_t getPressPoint();</mark>
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void setep() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
TouchPoint_t coordinate;
|
||||
coordinate = M5.Touch.getPressPoint();
|
||||
Serial.printf("x:%d, y:%d \r\n", coordinate.x, coordinate.y);
|
||||
}
|
||||
```
|
||||
## ispressed()
|
||||
|
||||
**Description**
|
||||
|
||||
Check that the screen is pressed
|
||||
|
||||
**Syntax**
|
||||
|
||||
<mark>bool ispressed();</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(M5.Touch.ispressed()) {
|
||||
Serial.println("Pressed");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## HotZone_t* createHotZone()
|
||||
|
||||
**Description**
|
||||
|
||||
Create a touch hotzone
|
||||
|
||||
**Syntax**
|
||||
|
||||
<mark>HotZone_t* creatHotZone(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, void (*fun)() = nullptr );</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void doFunc(void){
|
||||
Serial.println("executed doFunc()");
|
||||
}
|
||||
|
||||
HotZone Btn(0, 0, 320, 240, &doFunc));
|
||||
|
||||
|
||||
|
||||
void setup(){
|
||||
M5.begin();
|
||||
}
|
||||
void loop() {
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## inHotZone()
|
||||
|
||||
**Description**
|
||||
|
||||
Determine if it is in the hot zone
|
||||
|
||||
**Syntax**
|
||||
|
||||
<mark>bool inHotZone(TouchPoint_t point);</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include<M5Core2.h>
|
||||
|
||||
HotZone Btn(140, 100, 200, 160);
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
TouchPoint_t pos = M5.Touch.getPressPoint();
|
||||
if(Btn.inHotZone(pos)) {
|
||||
Serial.printf("%d, %d\r\n", pos.x, pos.y);
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,112 @@
|
||||
# TOUCH
|
||||
|
||||
## getPressPoint()
|
||||
|
||||
**功能**
|
||||
|
||||
获取触摸坐标
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>TouchPoint_t getPressPoint();</mark>
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void setep() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
TouchPoint_t coordinate;
|
||||
coordinate = M5.Touch.getPressPoint();
|
||||
Serial.printf("x:%d, y:%d \r\n", coordinate.x, coordinate.y);
|
||||
}
|
||||
```
|
||||
## ispressed()
|
||||
|
||||
**功能**
|
||||
|
||||
检查屏幕是否按压
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool ispressed();</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(M5.Touch.ispressed()) {
|
||||
Serial.println("Pressed");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## HotZone_t* createHotZone()
|
||||
|
||||
**功能**
|
||||
|
||||
创建一个触摸热区
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>HotZone_t* creatHotZone(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, void (*fun)() = nullptr );</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include <M5Core2.h>
|
||||
|
||||
void doFunc(void){
|
||||
Serial.println("executed doFunc()");
|
||||
}
|
||||
|
||||
HotZone Btn(0, 0, 320, 240, &doFunc));
|
||||
|
||||
|
||||
|
||||
void setup(){
|
||||
M5.begin();
|
||||
}
|
||||
void loop() {
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## inHotZone()
|
||||
|
||||
**功能**
|
||||
|
||||
判断是否在热区内
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool inHotZone(TouchPoint_t point);</mark>
|
||||
|
||||
**Example**
|
||||
|
||||
```arduino
|
||||
#include<M5Core2.h>
|
||||
|
||||
HotZone Btn(140, 100, 200, 160);
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
TouchPoint_t pos = M5.Touch.getPressPoint();
|
||||
if(Btn.inHotZone(pos)) {
|
||||
Serial.printf("%d, %d\r\n", pos.x, pos.y);
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
@@ -59,66 +59,11 @@
|
||||
|
||||
>4.在新弹出的对话框中,输入并搜索 `M5Stack`,点击`安装`(若出现搜索失败的情况,可以尝试重启Arduino程序)
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_4.webp">
|
||||
|
||||
>5.选择 `工具`->`开发板:`->`ESP32`
|
||||
|
||||
### For M5Core and M5Stick
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_5.webp">
|
||||
|
||||
### For M5StickC
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_77.webp">
|
||||
|
||||
### For M5StickC PLUS
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_77.webp">
|
||||
|
||||
### For Atom Matrix/Lite
|
||||
|
||||
>ATOM系列目前还未更新板选项,您可以选用M5StickC或ESP32 Pico KIT作为板配置。(注意:选用ESP32-Pico作为板配置时,波特率请采用115200)
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_77.webp">
|
||||
|
||||
## 相关库
|
||||
|
||||
>不同的硬件设备,有着不同的案例程序库,请根据你所使用的设备选择下载.打开 Arduino IDE, 然后选择 `项目`->`加载库`->`库管理...`
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_6.webp">
|
||||
|
||||
### For M5Core and M5Stick
|
||||
|
||||
?>搜索 `M5Stack` 并安装,如下图所示
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_7.webp">
|
||||
|
||||
### For M5StickC
|
||||
|
||||
?>搜索 `M5StickC` 并安装,如下图所示
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_8.webp">
|
||||
|
||||
### For M5StickC PLUS
|
||||
|
||||
>到此页面下载M5StickCPlus的库[M5StickCPlus](https://github.com/m5stack/M5StickC-Plus) ,添加 "M5StickC-Plus.zip"到库管理器中
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_55.webp">
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_22.webp">
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_33.webp">
|
||||
|
||||
>从例程中找到M5StickCPlus
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_44.webp">
|
||||
|
||||
### For Atom Matrix/Lite
|
||||
|
||||
?>搜索 `M5Atom` 并安装,如下图所示,使用LED可能你还需要安装FastLED库
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/Arduino_9.webp">
|
||||
<img src="assets/img/related_documents/Arduino_IDE/search_M5STACK.webp">
|
||||
|
||||
>5.选择 `工具`->`开发板:`->`M5Stack-Core2`
|
||||
|
||||
<img src="assets/img/related_documents/Arduino_IDE/board_select.webp">
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ const quickstart = {
|
||||
'BASIC / M5GO / FIRE / FACES':'#/zh_CN/arduino/arduino_development',
|
||||
'M5StickC':'#/zh_CN/arduino/arduino_development',
|
||||
'M5Stick':'#/zh_CN/arduino/arduino_development',
|
||||
'ATOM Lite / Matrix':'#/zh_CN/arduino/arduino_development'
|
||||
'ATOM Lite / Matrix':'#/zh_CN/arduino/arduino_development',
|
||||
'M5Core2':'#/zh_CN/arduino/arduino_core2_development'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,6 +57,24 @@ const m5core_api = {
|
||||
}
|
||||
};
|
||||
|
||||
const m5core2_api = {
|
||||
'title':"M5Core2 API",
|
||||
'item':{
|
||||
'System':'#/zh_CN/api/system',
|
||||
'Speaker':'#/zh_CN/api/speaker',
|
||||
'LCD':'#/zh_CN/api/lcd',
|
||||
'Button':'#/zh_CN/api/button',
|
||||
'IMU Sensor(MPU9250)':'#/zh_CN/api/mpu9250',
|
||||
'Button':'#/zh_CN/api/button',
|
||||
'TF Card':'#/zh_CN/api/tf',
|
||||
'Power':'#/zh_CN/api/power',
|
||||
'I/O':'#/zh_CN/api/gpio',
|
||||
'I2C':'#/zh_CN/api/commutil',
|
||||
'WIFI':'#/zh_CN/api/wifi',
|
||||
'Timer':'#/zh_CN/api/ticker',
|
||||
}
|
||||
};
|
||||
|
||||
const m5stickc_api = {
|
||||
'title':"M5StickC API",
|
||||
'item':{
|
||||
@@ -76,7 +95,8 @@ var arduino_home_page = new Vue({
|
||||
list: {
|
||||
quickstart: quickstart,
|
||||
m5core_api: m5core_api,
|
||||
m5stickc_api: m5stickc_api
|
||||
m5stickc_api: m5stickc_api,
|
||||
m5core2_api: m5core2_api
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="platform-box">
|
||||
<div class="platform-item" style="overflow:visible;">
|
||||
<img src="assets\img\quickstart_cn.webp" width="300px" data-no-zoom>
|
||||
</div>
|
||||
<div class="platform-item">
|
||||
<img src="assets\img\uiflow-card.webp" width="300px" data-no-zoom>
|
||||
<a href="/#/zh_CN/quick_start/m5core2/m5stack_core2_get_started_MicroPython">
|
||||
<h3>UIFlow</h3>
|
||||
<div class="platform-tag"></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="platform-item">
|
||||
<img src="assets\img\arduino-card.webp" width="300px" data-no-zoom>
|
||||
<a href="/#/zh_CN/arduino/arduino_core2_development">
|
||||
<h3>Arduino IDE</h3>
|
||||
<div class="platform-tag"></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user