mirror of
https://github.com/m5stack/M5Cloud.git
synced 2026-05-20 10:07:21 -07:00
updated README
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
- [Download firmware](#1download-firmware)
|
||||
- [MacOS/Linux](#macoslinux)
|
||||
- [Windows](#windows)
|
||||
- [Connect to WiFi](#2-configure-the-wifi)
|
||||
- [Connect the WiFi](#2-configure-the-wifi)
|
||||
- [Binding device](#3-binding-device)
|
||||
- [Coding](#4-coding)
|
||||
- [Micropython API](#m5stack-micropython)
|
||||
@@ -80,7 +80,7 @@ Windows can use Espressif Flash Download Tools([Download](https://www.espressif.
|
||||
|
||||
|
||||
|
||||
# **M5Stack** Micropython
|
||||
# Micropython API
|
||||
|
||||
Micropython Getting Started
|
||||
|
||||
@@ -389,16 +389,16 @@ import utime
|
||||
|
||||
while True:
|
||||
if buttonA.wasPressed():
|
||||
print('Button A was Pressed')
|
||||
lcd.print('Button A was Pressed\n')
|
||||
|
||||
if buttonA.wasReleased():
|
||||
print('Button A was Released')
|
||||
lcd.print('Button A was Released\n')
|
||||
|
||||
if buttonA.pressedFor(1.5):
|
||||
print('Button A pressed for 1.5s')
|
||||
lcd.print('Button A pressed for 1.5s\n')
|
||||
|
||||
if buttonA.releasedFor(2):
|
||||
print('Button A released for 2s press hold.')
|
||||
lcd.print('Button A released for 2s press hold\n')
|
||||
|
||||
utime.sleep(0.1)
|
||||
```
|
||||
@@ -407,14 +407,16 @@ Callback:
|
||||
|
||||
|
||||
```python
|
||||
from m5stack import *
|
||||
|
||||
def on_wasPressed():
|
||||
print('Button B was Pressed.')
|
||||
lcd.print('Button B was Pressed\n')
|
||||
|
||||
def on_wasReleased():
|
||||
print('Button B was Released.')
|
||||
lcd.print('Button B was Released\n')
|
||||
|
||||
def on_releasedFor():
|
||||
print('Button B released for 1.2s press hold.')
|
||||
lcd.print('Button B released for 1.2s press hold\n')
|
||||
|
||||
buttonB.wasPressed(on_wasPressed)
|
||||
buttonB.wasReleased(on_wasReleased)
|
||||
@@ -442,7 +444,7 @@ from m5stack import *
|
||||
|
||||
speaker.volume(2)
|
||||
speaker.tone(freq=1800)
|
||||
speaker.tone(freq=1800, timeout=200) # Non-blocking
|
||||
speaker.tone(freq=1800, duration=200) # Non-blocking
|
||||
```
|
||||
|
||||
## **GPIO**
|
||||
|
||||
+37
-8
@@ -1,6 +1,33 @@
|
||||
# M5Stack Web IDE
|
||||
|
||||
[EN](README.md) | [中文](README_CN.md) | [日本語](README_JP.md)
|
||||
|
||||
## 目录
|
||||
- [Getting Started](#Getting-Started)
|
||||
- [Burn firmware](#1-burn-firmware)
|
||||
- [Download firmware](#1download-firmware)
|
||||
- [MacOS/Linux](#macoslinux)
|
||||
- [Windows](#windows)
|
||||
- [Connect to WiFi](#2-configure-the-wifi)
|
||||
- [Binding device](#3-binding-device)
|
||||
- [Coding](#4-coding)
|
||||
- [Micropython API](#m5stack-micropython)
|
||||
- [LCD](#lcd)
|
||||
- [Button](#button)
|
||||
- [SD Card](#sd-card)
|
||||
- [Speaker](#speaker)
|
||||
- [GPIO](#gpio)
|
||||
- [PWM](#pwm)
|
||||
- [ADC](#adc)
|
||||
- [DAC](#dac)
|
||||
- [I2C](#i2c)
|
||||
- [SPI](#spi)
|
||||
- [UART](#uart)
|
||||
- [Timer](#timer)
|
||||
- [Neopixel](#neopixel)
|
||||
- [LoBo MicroPython WiKi](https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki)
|
||||
- [Examples](examples)
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 烧录固件
|
||||
@@ -67,7 +94,7 @@ Windows使用Espressif提供Flash Download Tools工具烧录([点击下载](http
|
||||
|
||||
|
||||
|
||||
# **M5Stack** Micropython
|
||||
# Micropython API
|
||||
|
||||
Micropython 快速入门
|
||||
|
||||
@@ -306,16 +333,16 @@ import utime
|
||||
|
||||
while True:
|
||||
if buttonA.wasPressed():
|
||||
print('Button A was Pressed')
|
||||
lcd.print('Button A was Pressed\n')
|
||||
|
||||
if buttonA.wasReleased():
|
||||
print('Button A was Released')
|
||||
lcd.print('Button A was Released\n')
|
||||
|
||||
if buttonA.pressedFor(1.5):
|
||||
print('Button A pressed for 1.5s')
|
||||
lcd.print('Button A pressed for 1.5s\n')
|
||||
|
||||
if buttonA.releasedFor(2):
|
||||
print('Button A released for 2s press hold.')
|
||||
lcd.print('Button A released for 2s press hold\n')
|
||||
|
||||
utime.sleep(0.1)
|
||||
```
|
||||
@@ -324,14 +351,16 @@ Callback:
|
||||
|
||||
|
||||
```python
|
||||
from m5stack import *
|
||||
|
||||
def on_wasPressed():
|
||||
print('Button B was Pressed.')
|
||||
lcd.print('Button B was Pressed\n')
|
||||
|
||||
def on_wasReleased():
|
||||
print('Button B was Released.')
|
||||
lcd.print('Button B was Released\n')
|
||||
|
||||
def on_releasedFor():
|
||||
print('Button B released for 1.2s press hold.')
|
||||
lcd.print('Button B released for 1.2s press hold\n')
|
||||
|
||||
buttonB.wasPressed(on_wasPressed)
|
||||
buttonB.wasReleased(on_wasReleased)
|
||||
|
||||
+12
-10
@@ -79,7 +79,7 @@ WindowsではEspressif Flash Download Toolsが使えます([ダウンロード](
|
||||
|
||||
|
||||
|
||||
# **M5Stack** Micropython
|
||||
# Micropython API
|
||||
|
||||
MicroPython入門
|
||||
|
||||
@@ -370,17 +370,17 @@ import utime
|
||||
|
||||
while True:
|
||||
if buttonA.wasPressed():
|
||||
print('Button A was Pressed')
|
||||
lcd.print('Button A was Pressed\n')
|
||||
|
||||
if buttonA.wasReleased():
|
||||
print('Button A was Released')
|
||||
lcd.print('Button A was Released\n')
|
||||
|
||||
if buttonA.pressedFor(1.5):
|
||||
print('Button A pressed for 1.5s')
|
||||
lcd.print('Button A pressed for 1.5s\n')
|
||||
|
||||
if buttonA.releasedFor(2):
|
||||
print('Button A released for 2s press hold.')
|
||||
|
||||
lcd.print('Button A released for 2s press hold\n')
|
||||
|
||||
utime.sleep(0.1)
|
||||
```
|
||||
|
||||
@@ -388,15 +388,17 @@ while True:
|
||||
|
||||
|
||||
```python
|
||||
from m5stack import *
|
||||
|
||||
def on_wasPressed():
|
||||
print('Button B was Pressed.')
|
||||
lcd.print('Button B was Pressed\n')
|
||||
|
||||
def on_wasReleased():
|
||||
print('Button B was Released.')
|
||||
lcd.print('Button B was Released\n')
|
||||
|
||||
def on_releasedFor():
|
||||
print('Button B released for 1.2s press hold.')
|
||||
|
||||
lcd.print('Button B released for 1.2s press hold\n')
|
||||
|
||||
buttonB.wasPressed(on_wasPressed)
|
||||
buttonB.wasReleased(on_wasReleased)
|
||||
buttonB.releasedFor(1.2, on_releasedFor)
|
||||
|
||||
Reference in New Issue
Block a user