描述 readBytesUntil()可以把串流收到的字元放到一个指定的阵列中。这个函式会直到侦测到结尾字符、符合指定的长度或超过指定时间后停止 (时间的设定可参考 Serial.setTimeout())。 readBytesUntil() 会回传在缓冲区中的字元总数。假如缓冲取内没有可用的值时,将回传 0。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.readBytesUntil(character, buffer, length) 参数 stream : 一个类别的实例,这个类别是继承于 Stream character : 要寻找的结尾字符 (char 型别) buffer : 储存资料的阵列 (char[] or byte[] 型别) length : 要读取的 byte 总数 (int 型别) 回传 缓冲区内的 byte 总数 See also - Stream 语法参考主页面 The text of the 86Duino […]
描述 readBytes() 可以从串流读取字元,然后把它们放到指定阵列中,直到符合指定的长度,或是超过一段时间 (时间的设定请参考 setTimeout())。 readBytes() 会回传在缓冲区中的字元总数。假如缓冲取内没有可用的值时,将回传 0。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 语法 stream.readBytes(buffer, length) 参数 stream : 一个类别的实例,这个类别是继承于 Stream buffer : 储存资料的阵列 (char[] or byte[] 型别) length : 要读取的 byte 总数 (int 型别) 回传 缓冲区内的 byte 总数 See also - Stream 语法参考主页面 The text of the 86Duino reference is a modification of the […]
描述 从串流收到并放在缓冲区内的资料中,取得下次呼叫 read() 会得到的值。呼叫这个函式并不会减少缓冲区内的资料总数,换句话说,透过 peek() 成功取得值后,下次用 read() 也会得到相同的值。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.peek() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 下一个可用的 byte (假如缓冲区内没有值,则回传 -1) int 型别 See also - Stream - available() - read() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a […]
描述 findUntil() 可以从外部进来的串流中读取资料,并且找到目标字串,或者找到结尾字串。 若有找到目标字串,则回传 true,一段时间内没找到,则回传 false。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.findUntil(target, terminal) 参数 stream : 一个类别的实例,这个类别是继承于 Stream target : 要找的字串 (char string) terminal : 结尾字串 (char string) 回传 布林值 See also - Stream 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a […]
描述 find() 可以从串流中读取资料,并且找到给定长度的目标字串。假如有找到目标字串,则回传 true,一段时间内没找到目标字串,则回传 false。 这个函式是 Stream 类别的一部分,它可以被任何继承 Stream 的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.find(target) 参数 stream : 一个类别的实例,这个类别是继承于 Stream target : 要找的字串 (char string) 回传 布林值 See also - Stream 语法参考主页面 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. […]
描述 flush() 可以将串流缓冲区内的值送出,直至里面没有任何值为止。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 语法 stream.flush() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 布林值 See also - Stream 语法参考主页面 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 […]
描述 read() 可以读取从外部串流进来并存到缓冲区的字元。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 语法 stream.read() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 读取传进来的 byte 值 (假如没有收到任何资料,则回传 -1) – int 型别 See also - Stream 语法参考主页面 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 […]
描述 available() 可以得到在串流中可用的 byte 数目,这里指的是接收到并放在缓冲区的 byte 数目。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 语法 stream.available() 参数 stream : 一个类别的实例,这个类别是继承于 Stream 回传 int : 可以读取的 byte 数 See also - Stream 语法参考主页面 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 […]
描述 setTimeout() 可以设定接收串流资料的最大等待时间 (以毫秒为单位),超过这个时间没有接收到任何资料,则判定为超时。预设值是 1 秒。 这个函式是 Stream 类别的一部分,它可以被任何继承它的类别呼叫 (例如:Wire、Serial 等等) 。 语法 stream.setTimeout(time) 参数 stream : 一个类别的实例,这个类别是继承于 Stream time : 等待资料进来的最大时间 (单位:毫秒,long 型别) 回传 无回传值 See also - Stream 语法参考主页面 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 […]
描述 缓冲区内有可用资料时会被呼叫的 callback 函式。你可以在这个函式内用 Serial.read() 来取得缓冲区内的资料。 语法 适用所有板子: void serialEvent(){ //statements } void serialEvent1(){ //statements } 适用 86Duino ONE: void serialEvent2(){ //statements } void serialEvent3(){ //statements } void serialEvent485(){ //statements } 适用 86Duino EduCake: void serialEvent2(){ //statements } void serialEvent3(){ //statements } void serialEvent232(){ //statements } 参数 […]