mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add ZH-CN api
This commit is contained in:
@@ -209,7 +209,7 @@ void loop() {
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("release Button A, 3 seconds will clear screen");
|
||||
}
|
||||
if (M5.BtnA.releasedFor(3000)) {
|
||||
if (M5.BtnA.wasReleasefor(3000)) {
|
||||
M5.Lcd.clear(BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ Open EEPROM,Size is the maximum address + 1 of the data bytes to be read and wri
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
Write data to storage space.
|
||||
|
||||
**Function argument**
|
||||
@@ -43,8 +41,6 @@ Write data to storage space.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
This function needs to be called every time an address is written.
|
||||
|
||||
**Function argument**
|
||||
@@ -59,8 +55,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
Reading data from storage space.
|
||||
|
||||
**Function argument**
|
||||
|
||||
+1
-7
@@ -258,7 +258,6 @@ Specify the port to output.
|
||||
|
||||
None.
|
||||
|
||||
|
||||
## ledcWrite()
|
||||
|
||||
**Syntax:**
|
||||
@@ -286,7 +285,6 @@ The unit of duty depends on the bit scale set at initialization.
|
||||
|
||||
When specifying with 8 bits, specifying 0xFF results in 100% output.
|
||||
|
||||
|
||||
## ledcDetachPin()
|
||||
|
||||
**Syntax:**
|
||||
@@ -388,8 +386,6 @@ Set the actual sampling times of single sampling, take the value of 1 ~ 255, def
|
||||
|
||||
None
|
||||
|
||||
|
||||
|
||||
## analogSetAttenuation()
|
||||
|
||||
**Syntax:**
|
||||
@@ -410,7 +406,6 @@ Set the global input attenuation of ADC to ADC_0db, ADC_2_5db, ADC_6db, ADC_11db
|
||||
|
||||
None
|
||||
|
||||
|
||||
## analogSetPinAttenuation()
|
||||
|
||||
**Syntax:**
|
||||
@@ -449,8 +444,7 @@ None
|
||||
|
||||
**Function return value:**
|
||||
|
||||
None.
|
||||
|
||||
int.
|
||||
|
||||
## attachInterrupt()
|
||||
|
||||
|
||||
@@ -689,6 +689,34 @@ Draws a straight line of the specified color from the specified start point to t
|
||||
M5.Lcd.drawChar(0,0,'A',TFT_GREEN,TFT_BLACK,3);
|
||||
```
|
||||
|
||||
## drawChar()
|
||||
|
||||
**Description:**
|
||||
|
||||
Draws a straight line of the specified start point to the end point.
|
||||
|
||||
**Syntax:**
|
||||
|
||||
<mark>drawChar(int16_t uniCode, int32_t x, uint16_t y, uint8_t font);</mark>
|
||||
|
||||
**Function argument:**
|
||||
|
||||
| argument | type | Description |
|
||||
| --- | --- | -- |
|
||||
| uniCode | int32_t | char |
|
||||
| x | int32_t | Coordinate X |
|
||||
| y | uint16_t | coordinate Y |
|
||||
| font | uint32_t | font |
|
||||
|
||||
**Example of use:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
M5.begin();
|
||||
M5.Lcd.drawChar('A', 160, 120, 2);
|
||||
```
|
||||
|
||||
## drawNumber()
|
||||
|
||||
**Description:**
|
||||
|
||||
@@ -25,7 +25,6 @@ void setup() {
|
||||
void loop(){};
|
||||
```
|
||||
|
||||
|
||||
## GetTime()
|
||||
|
||||
**Syntax:**
|
||||
@@ -97,7 +96,6 @@ void loop(){};
|
||||
|
||||
```
|
||||
|
||||
|
||||
## GetData()
|
||||
|
||||
**Syntax:**
|
||||
|
||||
+8
-66
@@ -27,7 +27,6 @@ Use this method to open AP mode and return true after successful opening
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
set AP IP address
|
||||
|
||||
**Function argument**
|
||||
@@ -46,8 +45,6 @@ set AP IP address
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Turn off the current AP and restore the network settings if wifioff is true
|
||||
|
||||
**Function argument**
|
||||
@@ -64,8 +61,6 @@ Turn off the current AP and restore the network settings if wifioff is true
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Returns the number of clients connected to AP
|
||||
|
||||
**Function argument**
|
||||
@@ -80,8 +75,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Returns current IP of AP
|
||||
|
||||
**Function argument**
|
||||
@@ -96,8 +89,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Set Hostname if success return true
|
||||
|
||||
**Function argument**
|
||||
@@ -114,15 +105,12 @@ Set Hostname if success return true
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Get Hostname if success return true
|
||||
|
||||
**Function argument**
|
||||
|
||||
None
|
||||
|
||||
|
||||
## WiFi.softAPmacAddress()
|
||||
|
||||
**Syntax:**
|
||||
@@ -131,8 +119,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
return MAC address
|
||||
|
||||
**Function argument**
|
||||
@@ -147,16 +133,14 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
This method is used to access the network .If connect equals true, it will connect to ssid's WiFi hotspot,If connect equals false, WiFi hotspots that are not connected to SSID will be created to save the above parameters.
|
||||
|
||||
**Function argument**
|
||||
|
||||
| Argument | Description | Type |
|
||||
| --- | --- | -- |
|
||||
| ssid |The name of an AP network 0-32 bytes | const char* |
|
||||
| passphrase | password NULL or 8-63 bytes | const char* |
|
||||
| ssid | WiFi hospot name | const char* |
|
||||
| passphrase | password | const char* |
|
||||
| channel | channel number | int32_t |
|
||||
| bssid | MAC address of WiFi hotspot, optional parameters | const uint8_t* |
|
||||
| connect | Establish a connection | bool |
|
||||
@@ -169,16 +153,15 @@ This method is used to access the network .If connect equals true, it will conne
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
set network addresses.
|
||||
|
||||
**Function argument**
|
||||
|
||||
| Argument | Description | Type |
|
||||
| --- | --- | -- |
|
||||
| local_ip | local_ip defult 192.168.4.1 | IPAddress |
|
||||
| gateway | gateway defult 192.168.4.1 | IPAddress |
|
||||
| subnet | subnet mask defult 255.255.255.0 | IPAddress |
|
||||
| local_ip | local_ip address | IPAddress |
|
||||
| gateway | gateway address | IPAddress |
|
||||
| subnet | subnet mask address | IPAddress |
|
||||
| dns1 | DNS address | IPAddress |
|
||||
| dns2 | DNS address | IPAddress |
|
||||
|
||||
@@ -191,8 +174,6 @@ set network addresses.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
If wifioff is true, the network settings will be restored. If eraseap is true, the network parameters saved in flash will be cleared.
|
||||
|
||||
**Function argument**
|
||||
@@ -210,8 +191,6 @@ If wifioff is true, the network settings will be restored. If eraseap is true, t
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Returns whether the network has been accessed or not.
|
||||
|
||||
**Function argument**
|
||||
@@ -226,15 +205,13 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Setting up automatic reconnection after disconnection.
|
||||
|
||||
**Function argument**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.setAutoReconnect()
|
||||
## WiFi.getAutoReconnect()
|
||||
|
||||
**Syntax:**
|
||||
|
||||
@@ -242,9 +219,7 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Setting up automatic reconnection after disconnection.
|
||||
Returns whether automatic reconnection occurs.
|
||||
|
||||
**Function argument**
|
||||
|
||||
@@ -258,8 +233,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return local IP address.
|
||||
|
||||
**Function argument**
|
||||
@@ -274,8 +247,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return subnet mask.
|
||||
|
||||
**Function argument**
|
||||
@@ -290,8 +261,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return gateway IP address.
|
||||
|
||||
**Function argument**
|
||||
@@ -306,8 +275,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return DNS address.
|
||||
|
||||
**Function argument**
|
||||
@@ -322,8 +289,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return MAC address.
|
||||
|
||||
**Function argument**
|
||||
@@ -338,8 +303,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return Hostname.
|
||||
|
||||
**Function argument**
|
||||
@@ -354,8 +317,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return WIFI status.
|
||||
|
||||
**Function return value**
|
||||
@@ -380,18 +341,11 @@ Return WIFI status.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
scan wifi networks.
|
||||
|
||||
**Function argument**
|
||||
|
||||
| Function argument |Type |Description |
|
||||
| --- | --- | --- |
|
||||
| async | false | Asynchronous scanning,the value is true, will not block |
|
||||
| show_hidden | false | Whether to scan non-broadcast networks |
|
||||
| passive | bool | boost scan |
|
||||
| max_ms_per_chan | uint32_t | Scanning time per channel |
|
||||
None
|
||||
|
||||
## WiFi.scanComplete()
|
||||
|
||||
@@ -401,8 +355,6 @@ scan wifi networks.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Asynchronous mode is used to obtain the number of scanned networks. If the return value is - 1, it means that the scan is still in progress. If the return value is - 2, it means that the scan has not been done or failed.
|
||||
|
||||
**Function argument**
|
||||
@@ -422,8 +374,6 @@ Asynchronous mode is used to obtain the number of scanned networks. If the retur
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Delete scan results in memory.
|
||||
|
||||
**Function argument**
|
||||
@@ -438,8 +388,6 @@ None
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Returns the scanned network name.
|
||||
|
||||
**Function argument**
|
||||
@@ -457,8 +405,6 @@ Returns the scanned network name.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Returns the type of network encryption scanned.
|
||||
|
||||
**Function argument**
|
||||
@@ -475,8 +421,6 @@ Returns the type of network encryption scanned.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return the scanned network signal strength.
|
||||
|
||||
**Function argument**
|
||||
@@ -493,8 +437,6 @@ Return the scanned network signal strength.
|
||||
|
||||
**Description:**
|
||||
|
||||
Load <WiFi.h> before use
|
||||
|
||||
Return the scanned network channel number.
|
||||
|
||||
**Function argument**
|
||||
|
||||
+3
-3
@@ -8,8 +8,8 @@
|
||||
|**[LCD 屏](zh_CN/api/lcd)** | **[按键](zh_CN/api/button)** |
|
||||
|**[MPU9250](zh_CN/api/mpu9250)** | **[TF 卡](zh_CN/api/tf)** |
|
||||
|**[电源管理](zh_CN/api/power)** |**[I/O](zh_CN/api/gpio)** |
|
||||
|**[I2C](zh_CN/api/commutil)** | |
|
||||
|
||||
|**[I2C](zh_CN/api/commutil)** | |**[EEPROM](zh_CN/api/eeprom)**|
|
||||
|**[WIFI](zh_CN/api/wifi)**|
|
||||
<!-- <table>
|
||||
<tr>
|
||||
<th align="center"><a href="#/zh_CN/api/system">System</a></th>
|
||||
@@ -38,7 +38,7 @@
|
||||
|:---:|:---:|
|
||||
|**[System](zh_CN/api/system_m5stickc)** | **[AXP192](zh_CN/api/axp192_m5stickc)** |
|
||||
|**[TFT 屏](zh_CN/api/lcd_m5stickc)** | **[SH200Q](zh_CN/api/sh200q_m5stickc)** |
|
||||
|
||||
|**[RTC](zh_CN/api/rtc)**|
|
||||
<!-- |**[麦克风](zh_CN/api/spm1423_m5stickc)** | **[LED](zh_CN/api/led_m5stickc)** |
|
||||
|
||||
|**[按键](zh_CN/api/buttom_m5stickc)** | **[红外发射](zh_CN/api/led_m5stickc)** | -->
|
||||
@@ -50,6 +50,33 @@ void loop() {
|
||||
}
|
||||
```
|
||||
|
||||
## lastChange()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint32_t lastChange(void);</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回最后一次状态发生变化的时间 .
|
||||
|
||||
**例程:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
int current_time = M5.BtnB.lastChange();
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.printf("The last change at No. %d ms",current_time);
|
||||
}
|
||||
```
|
||||
|
||||
## wasPressed()
|
||||
|
||||
**函数原型:**
|
||||
@@ -107,3 +134,97 @@ void loop() {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## releasedFor()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint8_t releasedFor(uint32_t ms)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
如果按键松开超过设定的时间则总是返回真
|
||||
|
||||
**例程:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
M5.Lcd.clear();
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
if (M5.BtnA.wasPressed()) {
|
||||
M5.Lcd.printf("Button A was pressed.");
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## wasReleased()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint8_t wasReleased(void)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
按键按下松开一次则返回一次真
|
||||
|
||||
**例程:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
M5.Lcd.print("Press Button A and release, you will see the message");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
if (M5.BtnA.wasReleased()){
|
||||
M5.Lcd.clear();
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("Button A was Released");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## wasReleasefor()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint8_t wasReleasefor(uint32_t ms);</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
按键按下,在超过指定时间后松开则返回真 .
|
||||
|
||||
**例程:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("press Button A to display message");
|
||||
delay(3000);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
if (M5.BtnA.isPressed()){
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("release Button A, 3 seconds will clear screen");
|
||||
}
|
||||
if (M5.BtnA.wasReleasefor(3000)) {
|
||||
M5.Lcd.clear(BLACK);
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,64 @@
|
||||
## EEPROM.begin()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>EEPROM.begin(size)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载<EEPROM.h>
|
||||
|
||||
开启EEPROM,大小为最大地址+1个字节,范围1-4096.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| size | int | EEPROM size |
|
||||
|
||||
## EEPROM.write()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>EEPROM.write(addr, data)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
向地址写入数据.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| addr | int | 空间存储地址 |
|
||||
| data | int | 数据 |
|
||||
|
||||
## EEPROM.commit()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>EEPROM.commit()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
每次向地址写入数据后都需要调用,保存数据.
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## EEPROM.read()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>EEPROM.read(addr)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
读取地址内存储的数据.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| addr | int | 读取地址内的数据 |
|
||||
+321
-19
@@ -46,7 +46,7 @@
|
||||
|
||||
## digitalRead()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>int digitalRead(uint8_t pin);</mark>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8</code> |Pin No |
|
||||
|
||||
@@ -79,7 +79,7 @@ pin21_data = digitalRead(21);
|
||||
|
||||
## digitalWrite()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void digitalWrite(uint8_t pin, uint8_t val);</mark>
|
||||
|
||||
@@ -89,7 +89,7 @@ pin21_data = digitalRead(21);
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8</code> |pin No |
|
||||
| val | <code>uint8</code> |输出状态(0/1) |
|
||||
@@ -112,7 +112,7 @@ digitalWrite(2,1);
|
||||
|
||||
## pinMode()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void pinMode(uint8_t pin, uint8_t mode);</mark>
|
||||
|
||||
@@ -122,7 +122,7 @@ digitalWrite(2,1);
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8</code> |pin No |
|
||||
| mode | <code>uint8</code> |INPUT,OUTPUT,INPUT_PULLUP 的任何一个|
|
||||
@@ -147,7 +147,7 @@ pinMode(2,INPUT);
|
||||
|
||||
## analogRead()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
<mark>uint16_t analogRead(uint8_t pin);</mark>
|
||||
|
||||
**功能:**
|
||||
@@ -156,7 +156,7 @@ pinMode(2,INPUT);
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8</code> |pin No |
|
||||
|
||||
@@ -177,7 +177,7 @@ ret=analogRead(35);
|
||||
|
||||
## dacWrite()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void dacWrite(uint8_t pin, uint8_t value);</mark>
|
||||
|
||||
@@ -187,7 +187,7 @@ ret=analogRead(35);
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8</code> |pin No |
|
||||
| value | <code>uint8</code> |设定输出电压 |
|
||||
@@ -208,7 +208,7 @@ dacWrite(25,0x40);
|
||||
|
||||
## ledcSetup()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>double ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits);</mark>
|
||||
|
||||
@@ -218,7 +218,7 @@ dacWrite(25,0x40);
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| channel | <code>uint8</code> |channel (0~15) |
|
||||
| freq | <code>double</code> |frequency (Hz) |
|
||||
@@ -237,17 +237,17 @@ Actual output frequency.
|
||||
|
||||
## ledcAttachPin()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void ledcAttachPin(uint8_t pin, uint8_t chan);</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
Specify the port to output.
|
||||
指定引脚.
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8_t</code> |pin No) |
|
||||
| chan | <code>uint8_t</code> |渠道(0~15) |
|
||||
@@ -259,7 +259,7 @@ Specify the port to output.
|
||||
|
||||
## ledcWrite()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void ledcWrite(uint8_t chan, uint32_t duty);</mark>
|
||||
|
||||
@@ -269,7 +269,7 @@ Specify the port to output.
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| chan | <code>uint8_t</code> |渠道(0~15) |
|
||||
| duty | <code>uint32_t</code> |比 |
|
||||
@@ -287,7 +287,7 @@ Specify the port to output.
|
||||
|
||||
## ledcDetachPin()
|
||||
|
||||
**構文:**
|
||||
**函数原型:**
|
||||
|
||||
<mark>void ledcDetachPin(uint8_t pin);</mark>
|
||||
|
||||
@@ -297,7 +297,7 @@ Specify the port to output.
|
||||
|
||||
**参数**
|
||||
|
||||
| 参数 |型 |功能 |
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | <code>uint8_t</code> |pin No |
|
||||
|
||||
@@ -305,3 +305,305 @@ Specify the port to output.
|
||||
**返回值:**
|
||||
|
||||
无。
|
||||
|
||||
## adcAttachPin()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool adcAttachPin(uint8_t pin)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
非阻塞模式.连接设定引脚到ADC .
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | 指定引脚 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
设置成功返回1
|
||||
|
||||
## adcBusy()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool adcBusy(uint8_t pin)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
非阻塞模式,检查adc转换是否进行中.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | 指定引脚 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
转换中返回1
|
||||
|
||||
## adcEnd()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint16_t adcEnd(uint8_t pin)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
非阻塞模式,返回转换结果,如果未转换完成等待完成.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | 指定引脚 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
返回转换结果
|
||||
|
||||
## adcStart()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool adcStart(uint8_t pin)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
非阻塞模式,开启adc转换.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | 指定引脚 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
成功开启返回1
|
||||
|
||||
|
||||
## analogReadResolution()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogReadResolution(uint8_t bits)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置模拟数据读取分辨率,取值1~16,默认为12。如果介于9和12之间,它将等于设置的硬件分辨率,否则值将被移动.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| bits | uint8_t | 采样分辨率 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## analogSetAttenuation()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogSetAttenuation(adc_attenuation_t attenuation)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置ADC全局输入衰减,取值ADC_0db, ADC_2_5db, ADC_6db, ADC_11db,默认为11db
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| attenuation | adc_attenuation_t | 衰减值 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## analogSetCycles()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogSetCycles(uint8_t cycles)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置采样周期1-255,默认为8.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| cycles | uint8_t | sampling period |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## analogSetPinAttenuation()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置某个单独引脚衰减
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | specified pin |
|
||||
| attenuation | adc_attenuation_t | 衰减值 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## analogSetSamples()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogSetSamples(uint8_t samples)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置单次采样的实际采样倍数,取值1-255,默认为1,实际效果为提高adc灵敏度,采样次数扩大N倍;
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| samples | uint8_t | 采样倍数 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## analogSetWidth()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void analogSetWidth(uint8_t bits)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置adc采样分辨率9-12,默认为12.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| bits | uint8_t | 采样分辨率 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None
|
||||
|
||||
## attachInterrupt()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void attachInterrupt(pin, ISR(callback function), interrupt type/mode)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置引脚中断.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | 引脚 |
|
||||
| ISR | callcack function | 回调函数 |
|
||||
| interrupt | mode | 触发类型 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None.
|
||||
|
||||
## detachInterrupt()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void detachInterrupt(pin)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
Prohibit specified pin interruptio.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 |类型 |功能 |
|
||||
| --- | --- | --- |
|
||||
| pin | uint8_t | pin No. |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
None.
|
||||
|
||||
## hallRead()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int hallRead(void));</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
读取霍尔传感器.
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
int.
|
||||
|
||||
## ledcRead()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint32_t ledcRead(uint8_t channel)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回指定通道的占空比.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| channel | uint8_t | 指定通道 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
占空比
|
||||
|
||||
## ledcReadFreq()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>double ledcReadFreq(uint8_t channel)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回当前通道频率.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 |类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| channel | uint8_t | 指定通道 |
|
||||
|
||||
**函数返回值:**
|
||||
|
||||
通道频率
|
||||
+585
-7
File diff suppressed because it is too large
Load Diff
@@ -256,4 +256,43 @@ void loop(){
|
||||
Serial.println(" mg ");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## readTempData()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int16_t readTempData(void);</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
读取温度.
|
||||
|
||||
**例程:**
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
#include "utility/MPU9250.h"
|
||||
|
||||
MPU9250 IMU; // new a MPU9250 object
|
||||
|
||||
void setup()
|
||||
{
|
||||
M5.begin();
|
||||
Wire.begin();
|
||||
|
||||
IMU.calibrateMPU9250(IMU.gyroBias, IMU.accelBias);
|
||||
IMU.initMPU9250();
|
||||
IMU.initAK8963(IMU.magCalibration);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
IMU.tempCount = IMU.readTempData();
|
||||
IMU.temperature = ((float) IMU.tempCount) / 333.87 + 21.0;
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("MPU9250 Temperature is ");
|
||||
M5.Lcd.print(IMU.temperature, 1);
|
||||
delay(500);
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,139 @@
|
||||
## SetTime()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void SetTime(RTC_TimeTypeDef* RTC_TimeStruct)</mark>
|
||||
|
||||
**函数参数:**
|
||||
|
||||
设置结构体变量时间
|
||||
|
||||
**示例:**
|
||||
|
||||
```arduino
|
||||
#include <M5StickC.h>
|
||||
|
||||
RTC_TimeTypeDef TimeStruct;
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
TimeStruct.Hours = 18;
|
||||
TimeStruct.Minutes = 56;
|
||||
TimeStruct.Seconds = 10;
|
||||
M5.Rtc.SetTime(&TimeStruct);
|
||||
}
|
||||
void loop(){};
|
||||
```
|
||||
|
||||
|
||||
## GetTime()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void GetTime(RTC_TimeTypeDef* RTC_TimeStruct)</mark>
|
||||
|
||||
**函数参数:**
|
||||
|
||||
获取结构体时间
|
||||
|
||||
**示例:**
|
||||
|
||||
```arduino
|
||||
|
||||
#include <M5StickC.h>
|
||||
|
||||
RTC_TimeTypeDef TimeStruct;
|
||||
void setup() {
|
||||
M5.begin();
|
||||
M5.Lcd.setRotation(3);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
|
||||
M5.Lcd.setTextSize(1);
|
||||
M5.Lcd.setCursor(40, 0, 2);
|
||||
M5.Lcd.println("RTC TEST");
|
||||
|
||||
TimeStruct.Hours = 18;
|
||||
TimeStruct.Minutes = 56;
|
||||
TimeStruct.Seconds = 10;
|
||||
M5.Rtc.SetTime(&TimeStruct);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.Rtc.GetTime(&TimeStruct);
|
||||
M5.Lcd.setCursor(0, 15);
|
||||
M5.Lcd.printf("Time: %02d : %02d : %02d\n",TimeStruct.Hours, TimeStruct.Minutes, TimeStruct.Seconds);
|
||||
delay(500);
|
||||
}
|
||||
```
|
||||
|
||||
## SetData()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void SetData(RTC_TimeTypeDef* RTC_DateStruct)</mark>
|
||||
|
||||
**函数参数:**
|
||||
|
||||
设置结构体变量日期
|
||||
|
||||
**示例:**
|
||||
|
||||
```arduino
|
||||
|
||||
#include <M5StickC.h>
|
||||
|
||||
RTC_TimeTypeDef TimeStruct;
|
||||
RTC_DateTypeDef DateStruct;
|
||||
void setup() {
|
||||
M5.begin();
|
||||
|
||||
DateStruct.WeekDay = 3;
|
||||
DateStruct.Month = 3;
|
||||
DateStruct.Date = 22;
|
||||
DateStruct.Year = 2019;
|
||||
M5.Rtc.SetData(&DateStruct);
|
||||
}
|
||||
void loop(){};
|
||||
|
||||
```
|
||||
|
||||
|
||||
## GetData()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void GetData(RTC_TimeTypeDef* RTC_DateStruct)</mark>
|
||||
|
||||
**函数参数:**
|
||||
|
||||
获取结构体变量日期
|
||||
|
||||
**示例:**
|
||||
|
||||
```arduino
|
||||
#include <M5StickC.h>
|
||||
|
||||
RTC_DateTypeDef DateStruct;
|
||||
void setup() {
|
||||
M5.begin();
|
||||
M5.Lcd.setRotation(3);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
|
||||
M5.Lcd.setTextSize(1);
|
||||
M5.Lcd.setCursor(40, 0, 2);
|
||||
M5.Lcd.println("RTC TEST");
|
||||
|
||||
DateStruct.WeekDay = 3;
|
||||
DateStruct.Month = 3;
|
||||
DateStruct.Date = 22;
|
||||
DateStruct.Year = 2019;
|
||||
M5.Rtc.SetData(&DateStruct);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.Rtc.GetData(&DateStruct);
|
||||
M5.Lcd.setCursor(0, 15);
|
||||
M5.Lcd.printf("Data: %04d-%02d-%02d\n",DateStruct.Year, DateStruct.Month,DateStruct.Date);
|
||||
M5.Lcd.printf("Week: %d\n",DateStruct.WeekDay);
|
||||
delay(500);
|
||||
}
|
||||
@@ -0,0 +1,447 @@
|
||||
## WiFi.softAP()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool WiFi.softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden, int max_connection)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载 <WiFi.h>
|
||||
|
||||
开启AP模式,开启成功返回真
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| ssid | AP名称 0-32个字节 | const char* |
|
||||
| passphrase | 密码8-63个字节或NULL| const char* |
|
||||
| ssid_hidden | 是否隐藏SSID 1:隐藏 0:不隐藏 | int |
|
||||
| max_conncetion | 最大连接数量1-4 | int |
|
||||
|
||||
## WiFi.softAPConfig()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置AP的IP地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| local_ip | 默认本地IP 192.168.4.1 | IPAddress |
|
||||
| gateway | 默认网关 192.168.4.1 | IPAddress |
|
||||
| subnet | 默认子网掩码 255.255.255.0 | IPAddress |
|
||||
|
||||
## WiFi.softAPdisconnect()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool softAPdisconnect(bool wifioff = false)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
关闭当前AP,wifioff设置为true则还原网络设置
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| wifioff | 还原设置 | bool |
|
||||
|
||||
## WiFi.softAPgetStationNum()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>uint8_t softAPgetStationNum()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回连接到AP的客户端数量
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.softAPIP()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>IPAddress softAPIP()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回当前AP的IP地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.softAPsetHostname()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool softAPsetHostname(const char * hostname)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置主机名称,成功返回真
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| hostname | 主机名称 | const char* |
|
||||
|
||||
## WiFi.softAPgetHostname()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>const char * softAPgetHostname()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
获得主机名称
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.softAPmacAddress()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>String softAPmacAddress(void)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回主机MAC
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.begin()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用这个方法来接入网络.如果connect参数为真则接入网络,如果参数为假则只保存设置,返回wifi状态
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| ssid | 网络热点名称 | const char* |
|
||||
| passphrase | 密码 | const char* |
|
||||
| channel | 热点通道号 | int32_t |
|
||||
| bssid | 热点的mac地址 可选 | const uint8_t* |
|
||||
| connect | 建立连接 | bool |
|
||||
|
||||
## WiFi.config()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
配置网络地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| local_ip | 设置IP| IPAddress |
|
||||
| gateway | 设置网关 | IPAddress |
|
||||
| subnet | 设置子网掩码 | IPAddress |
|
||||
| dns1 | 设置DNS1 | IPAddress |
|
||||
| dns2 | 设置DNS2 | IPAddress |
|
||||
|
||||
|
||||
## WiFi.disconnect()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool disconnect(bool wifioff = false, bool eraseap = false)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
断开网络连接,若wifioff为true则还将还原网络设置,若eraseap为true则将清除保存于flash中的网络参数.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 描述 | 类型 |
|
||||
| --- | --- | -- |
|
||||
| wifioff | 还原设置 | bool |
|
||||
| eraseap | flash清除AP设置 | bool |
|
||||
|
||||
## WiFi.isConnected()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool isConnected()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回网络连接状态
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.setAutoReconnect()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool setAutoReconnect(bool autoReconnect)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
设置自动重连.
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.getAutoReconnect()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>bool getAutoReconnect()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回是否重新连接
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.localIP()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>IPAddress localIP()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回本地IP地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.subnetMask()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>IPAddress subnetMask()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回子网掩码
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.gatewayIP()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>IPAddress gatewayIP()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回网关地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.dnsIP()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>IPAddress dnsIP(uint8_t dns_no = 0)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回DNS地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.macAddress()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>String macAddress()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回mac地址
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.getHostname()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>const char * getHostname()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
主机名称
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.status()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>wl_status_t status()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回WiFi状态
|
||||
|
||||
**返回值**
|
||||
|
||||
| 值 | 描述 |
|
||||
| --- | --- |
|
||||
| 255 | WL_NO_SHIELD 检查WiFi Shield |
|
||||
| 0 | WL_IDLE_STATUS 正在WiFi工作模式间切换 |
|
||||
| 1 | WL_NO_SSID_AVAIL 无法访问设置的SSID网络 |
|
||||
| 2 | WL_SCAN_COMPLETED 扫描完成 |
|
||||
| 3 | WL_CONNECTED 连接成功 |
|
||||
| 4 | WL_CONNECT_FAILED 连接失败 |
|
||||
| 5 | WL_CONNECTION_LOST 丢失连接 |
|
||||
| 6 | WL_DISCONNECTED 断开连接 |
|
||||
|
||||
|
||||
## WiFi.scanNetworks()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
异步扫描WiFi网络,非阻塞模式
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| async | false | 异步扫描,值为true时启动 |
|
||||
| show_hidden | false | 是否扫描隐藏网络 |
|
||||
| passive | bool | 快速扫描 |
|
||||
| max_ms_per_chan | uint32_t | 通道扫描时间 |
|
||||
|
||||
## WiFi.scanComplete()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int16_t scanComplete()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
异步模式下获取扫描网络.返回值-1表示扫描未完成.返回值为-2表示扫描失败.
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.scanDelete()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void scanDelete()</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
从内存中删除扫描结果
|
||||
|
||||
**函数参数**
|
||||
|
||||
None
|
||||
|
||||
## WiFi.SSID()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>String SSID(uint8_t networkItem)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回扫描到的网络.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| networkItem | uint8_t | SSID名称 |
|
||||
|
||||
|
||||
## WiFi.encryptionType()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>wifi_auth_mode_t encryptionType(uint8_t networkItem)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回扫描到的加密网络
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 函数参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| networkItem | uint8_t | SSID名称 |
|
||||
|
||||
## WiFi.RSSI()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int32_t RSSI(uint8_t networkItem)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回扫描到的RSSI强度
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| networkItem | uint8_t | RSSI item |
|
||||
|
||||
## WiFi.channel()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>int32_t channel(uint8_t networkItem)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
返回扫描到的网络通道号
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| networkItem | uint8_t | channel item |
|
||||
|
||||
Reference in New Issue
Block a user