> For the complete documentation index, see [llms.txt](https://arduino.doc.skyone.host/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arduino.doc.skyone.host/core/serial/other.md).

# 其它方法

## `Serial.end`

### 函数原型

```cpp
void HardwareSerial::end()
```

### 描述

结束串口通信。

无参数，无返回值。

## `Serial.find`

### 函数原型

```cpp
bool find(char *target);
bool find(uint8_t *target);
bool find(char *target, size_t length);
bool find(uint8_t *target, size_t length);
bool find(char target);
```

### 作用

从串口缓冲区读取数据，直到读取到指定的字符串。

### 参数

* target

  需要搜索的字符串或字符
* length

  最多搜索的长度

### 返回值

Boolean型

* True：找到
* False：没有找到

## `findUntil()`

从串口缓冲区读取数据，直到读取到指定的字符串或指定的停止符。

### 原型

```cpp
bool Serial.findUntil(target, terminal)
```

### 参数：

* target

  需要搜索的字符串或字符
* terminal

  停止符

### 返回值：

bool型数据，是否找到

## `flush()`

等待正在发送的数据发送完成。

### 语法：

```cpp
void Serial.flush()
```

## `parseFloat()`

从串口缓冲区返回第一个有效的float型数据。

### 语法：

```cpp
float Serial.parseFloat()
```

### 返回值：

float 型数据

## `parseInt()`

从串口流中查找第一个有效的整型数据。

### 语法：

```cpp
int Serial.parseInt()
```

### 返回值：

int 型数据

## `peek()`

返回 1 字节的数据，但不会从接受缓冲区删除该数据。

与 `read()` 的不同之处在于 `read()` 读取数据后，会从接受缓冲区删除该数据。

### 语法：

```cpp
int HardwareSerial::peek()
```

### 返回值：

进入接受缓冲区的第一个字节的数据；如果没有可读数据，则返回-1
