Articles Posted in the " " Category

  • read()

    read()

    描述 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()

    available()

    描述 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()

    setTimeout()

    描述 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 […]


  • serialEvent()

    serialEvent()

    描述 缓冲区内有可用资料时会被呼叫的 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 } 参数 […]


  • write()

    write()

    描述 从序列埠送出二进制的资料。这些资料是以一个 byte 或连续的 bytes 被送出的;若你想用十进制的方式来传送数字,请改用 print()。 语法 Serial.write(val) Serial.write(str) Serial.write(buf, len) 参数 val: 要送出的 byte 值 str: 要送出的字串 buf: 要送出的阵列内容 len: 要送出的阵列内容长度 回传 byte: write() 将回传写到缓冲区内的 byte 数。 范例 See also - Serial - available() - begin() - end() - find() - findUntil() - flush() - parseFloat() - parseInt() - peek() - print() - […]


  • Serial.setTimeout()

    Serial.setTimeout()

    描述 Serial.setTimeout() 可以设定序列埠接收资料时的最大等待时间 (以毫秒为单位),超过这个时间没有接收到任何资料,则判定为超时。可以应用在例如:Serial.readBytesUntil() 或 Serial.readBytes()。预设值是 1 秒。 Serial.setTimeout() 是继承于 Stream 类别。 语法 Serial.setTimeout(time) 参数 time : 等待资料进来的最大时间 (单位:毫秒,long 型别) 回传 无回传值 See also - Serial - Stream - Stream.setTimeout() 语法参考主页面 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 […]


  • Serial.readBytesUntil()

    Serial.readBytesUntil()

    描述 Serial.readBytesUntil() 可以把收到 (在缓冲区内) 的字元放到一个指定的阵列中。这个函式会直到侦测到结尾字符、符合指定的长度或超过指定时间后停止 (时间的设定可参考 Serial.setTimeout())。 Serial.readBytesUntil() 会回传在缓冲区中的字元总数。假如缓冲取内没有可用的值时,将回传 0。 Serial.readBytesUntil() 是继承于 Stream 类别。 语法 Serial.readBytesUntil(character, buffer, length) 参数 character : 要寻找的结尾字符 (char 型别) buffer : 储存资料的阵列 (char[] or byte[] 型别) length : 要读取的 byte 总数 (int 型别) 回传 byte See also - Serial - Stream - Stream.readBytesUntil() 语法参考主页面 The text of the 86Duino reference […]


  • Serial.readBytes()

    Serial.readBytes()

    描述 Serial.readBytes() 可以把收到 (在缓冲区内) 的字元放到指定的阵列中,直到符合指定的长度或是超过一段时间 (时间的设定请参考 Serial.setTimeout()). Serial.readBytes() 会回传在缓冲区中的字元总数。假如缓冲区内没有可用的值时,将回传 0。 Serial.readBytes() 是继承于 Stream 类别。 语法 Serial.readBytes(buffer, length) 参数 buffer: 储存资料的阵列 (char[] or byte[] 型别) length: 要读取的 byte 总数 (int 型别) 回传 byte See also - Stream - Stream.readBytes() 语法参考主页面 The text of the 86Duino reference is a modification of the Arduino reference, and is licensed […]


  • read()

    read()

    描述 读取序列埠收到的资料。read() 是继承于 Stream 类别。 语法 适用所有板子: Serial.read() Serial1.read() 适用 86Duino ONE: Serial2.read() Serial3.read() Serial485.read() 适用 86Duino EduCake: Serial2.read() Serial3.read() Serial232.read() 参数 回传 读取传进来的 byte 值 (假如没有收到任何资料,则回传 -1) int 型别 范例 See also - Serial - available() - begin() - end() - find() - findUntil() - flush() - parseFloat() - parseInt() - peek() - […]


  • println()

    println()

    描述 透过序列埠印出具有阅读性的 ASCII 文字,后面再接着回车字元 (ASCII 13 或 \r) 和新列字元 (ASCII 10 或 \n)。这个函式和 Serial.print() 有相同的格式。 语法 Serial.println(val) Serial.println(val, format) 参数 val: 要印的值 任意型别 format: 指定印出的格式 (对于整数的资料型别) 或小数点后的位数 (对于符点数资料型别) 回传 size_t (long):print() 的 byte 数 范例 See also - Serial - available() - begin() - end() - find() - findUntil() - flush() - parseFloat() - parseInt() […]