描述 送出缓冲区内尚未传送的资料,并等待其完成。 flush() 是继承于 Stream 类别。 语法 适用所有板子: Serial.flush() Serial1.flush() 适用 86Duino ONE: Serial2.flush() Serial3.flush() Serial485.flush() 适用 86Duino EduCake: Serial2.flush() Serial3.flush() Serial232.flush() 参数 回传 无回传值 See also - Serial - available() - begin() - end() - find() - findUntil() - parseFloat() - parseInt() - peek() - print() - println() - read() - readBytes() - […]
描述 Serial.findUntil() 可以从串列埠缓冲区读取资料,并且找到目标字串,或者找到结尾字串。 若有找到目标字串,则回传 true,一段时间内没找到,则回传 false。 Serial.findUntil() 是继承于 Stream 类别。 语法 Serial.findUntil(target, terminal) 参数 target : 要找的字串 (char string) terminal : 要找的结尾字串 (char string) 回传 布林值 (true 或 false) See also - Stream - Stream.findUntil() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative […]
描述 Serial.find() 可以从串列埠缓冲区读取资料,并且找到目标字串。假如有找到目标字串,则回传 true,一段时间内没找到目标字串,则回传 false。 Serial.find() 是继承于 Stream 类别。 语法 Serial.find(target) 参数 target : 要找的字串 (char string) 回传 布林值 (true 或 false) See also - Stream - Stream.find() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in […]
描述 关闭串列埠传输,并允许 TX 和 RX 脚做为一般资料输入、输出用。如果想要重新启用串列埠传输,只要再呼叫一次 Serial.begin() 即可。 语法 适用所有板子: Serial.end() Serial1.end() 适用 86Duino ONE/EduCake: Serial2.end() Serial3.end() 参数 回传值 无回传值 See also - Serial - available() - begin() - find() - findUntil() - flush() - parseFloat() - parseInt() - peek() - print() - println() - read() - readBytes() - readBytesUntil() - setTimeout() - write() […]
描述 设定以每秒多少 bit 的速度 (又称为鲍率) 来传输串列资料。电脑透过串列埠在传输资料时,通常是使用 300、600、1200、2400、4800、9600、14400、19200、28800、38400、57600 或 115200 鲍率。除此之外,你也可以指定其它的鲍率,然后透过板子上的 0 和 1 脚,与一个需要特殊鲍率的元件做沟通。在 86Duino 上最高可以支援到 6000000 (6Mbps) 的鲍率。 除了鲍率外还有第二个可选的输入参数,其值包含了资料位元、同位元检查和停止位元。预设是 8 个资料位元,非同位元检查,以及一个停止位元。 第三个可选参数,是用来选择全双工或半双工模式。预设是全双工模式。 语法 适用所有板子: Serial.begin(speed) Serial1.begin(speed) Serial.begin(speed, config) Serial1.begin(speed, config) Serial1.begin(speed, mode) Serial1.begin(speed, config, mode) 适用 86Duino ONE: Serial2.begin(speed) Serial3.begin(speed) Serial485.begin(speed) Serial2.begin(speed, config) Serial3.begin(speed, config) Serial485.begin(speed, config) Serial2.begin(speed, mode) Serial3.begin(speed, mode) Serial2.begin(speed, config, mode) […]
描述 透过串列埠,取得可供读取的 byte (字元) 个数。这些可供读取的资料已经被串列埠读取进来并且储存在记忆体中 (最多 4096 bytes)。available() 是继承于 Stream 类别。 语法 适用所有板子: Serial.available() Serial1.available() 适用 86Duino ONE: Serial2.available() Serial3.available() Serial485.available() 适用 86Duino EduCake: Serial2.available() Serial3.available() Serial232.available() 参数 回传 可供读取的 byte 数 范例 其他范例: See also - Serial - begin() - end() - find() - findUntil() - flush() - parseFloat() - parseInt() - peek() […]
描述 指定的串列埠是否可用。 在所有 86Duino 板子上,使用 if (Serial) 可以知道 USB CDC 虚拟序列埠是否已经被开启。对于其他硬体序列埠 (UART),例如使用 if (Serial1) 则总是回传 true。 语法 适用所有板子: if (Serial) if (Serial1) 适用 86Duino ONE: if (Serial2) if (Serial3) if (Serial485) 适用 86Duino EduCake: if (Serial2) if (Serial3) if (Serial232) 参数 回传 布林值:指定的序列埠假如是可用的状态时,则回传 true。假如 USB CDC 虚拟序列埠是不可用的状态,则回传 false。 范例 See also - Serial - […]
描述 关闭所有中断 (可以使用 Interrupts() 重启所有中断),中断让一些重要的任务可以在背景下执行,而它预设是开启的;当中断被关闭的时候,可能会造成一些函式不能正确运行,或者漏收的传进来的资料。由于中断会稍微断开主程式执行的时间,所以在主程式的临界区间中应该要关闭中断。 参数 回传 无回传值 范例 See also - Interrupts() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
描述 关闭已启用的中断。 语法 detachInterrupt(interrupt) 参数 interrupt: 要关闭的中断之数字 (详见 attachInterrupt()) See also - attachInterrupt() 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
描述 重启所有中断 (例如:在 noInterrupts() 关闭所有中断之后呼叫),中断让一些重要的任务可以在背景下执行,而它预设是开启的;当中断被关闭的时候,可能会造成一些函式不能正确运行,或者漏收的传进来的资料。由于中断会稍微断开主程式执行的时间,所以在主程式的临界区间中应该要关闭中断。 参数 回传 无回传值 范例 See also - noInterrupts() - attachInterrupt() - detachInterrupt() 语法参考主页面 本页由热血青年 LBU 译自英文版。 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public […]