Articles Posted by the Author:

  • read()

    read()

    描述 读取编码器计数器数值或脉波宽度。此函式回传值在不同工作模式下有不同意义,请见下面说明。 语法 Enc0.read() Enc1.read() Enc2.read() Enc3.read() 参数 Enc0、Enc1、Enc2、Enc3:分别对应 ENC0、ENC1、ENC2、ENC3 编码器介面。 回传 Pulse/DIR、CW/CCW、A/B Pulse 模式:回传编码器所计数的值。 PWM 脉波捕捉模式:回传脉波 LOW 或 HIGH 的宽度(单位:us),最长可量测宽度约 71 分钟。注意:在此模式下,read() 只能在 ISR 函式内被呼叫,如果在其它地方被呼叫,将总是回传 0。 SSI 模式:回传由 SSI 绝对编码器读到的数值。 范例 设定 ENC0 为 A/B Pulse 模式,并读取编码器计数器数值: 设定 ENC1 为 PWM 脉波捕捉模式,并读取脉波的 HIGH、LOW 宽度: See also - attachInterrupt() 函式库参考主页面 The text of the 86Duino […]


  • write()

    write()

    描述 将 86Duino 编码器计数器设定为指定值。此函式只可用于 Pulse/DIR、CW/CCW、A/B Pulse 工作模式。 语法 Enc0.write(number) Enc1.write(number) Enc2.write(number) Enc3.write(number) 参数 Enc0、Enc1、Enc2、Enc3:分别对应 ENC0、ENC1、ENC2、ENC3 编码器介面。 number:指定给编码器计数器的值。(unsigned long 型别) 回传 无回传值 范例 See also - read() 函式库参考主页面 The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


  • begin()

    begin()

    描述 初始化 86Duino 编码器介面,并指定工作模式。 语法 Enc0.begin(mode) Enc0.begin(mode, bits) Enc0.begin(mode, bits, clock) Enc0.begin(mode, bits, clock, wtime) Enc0.begin(mode, bits, clock, wtime, gray2bin) Enc1.begin(mode) Enc1.begin(mode, bits) Enc1.begin(mode, bits, clock) Enc1.begin(mode, bits, clock, wtime) Enc1.begin(mode, bits, clock, wtime, gray2bin) Enc2.begin(mode) Enc2.begin(mode, bits) Enc2.begin(mode, bits, clock) Enc2.begin(mode, bits, clock, wtime) Enc2.begin(mode, bits, clock, wtime, gray2bin) Enc3.begin(mode) Enc3.begin(mode, bits) Enc3.begin(mode, bits, […]


  • write()

    write()

    描述 从音频缓冲区播放音频讯号。 语法 Audio.write(buffer, length); 参数 buffer(short):储存音频样本的缓冲区。 length(int):要输出的样本数量。 回传 无回传值 范例 函式库参考主页面 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.


  • prepare()

    prepare()

    描述 预备从档案读取至缓冲区的音频样本并且设置音量。 语法 Audio.prepare(buffer, samples, volume); 参数 buffer(short):储存音频样本的缓冲区。 samples(int):缓冲区中储存的音频样本数量。 volume(int):一个 10 位元的数字,代表音频的音量。0 表示没有声音,1023 是最大声。 回传 无回传值 范例 函式库参考主页面 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.


  • begin()

    begin()

    描述 藉由给予取样率和缓冲时间的大小初始化 Audio 函式库。 语法 Audio.begin(rate, size); 参数 rate(int):音频档案的取样率。如果音频是立体声,取样率必须乘以 2(如. 44100hz 立体声 = 88200)。 size(int):音频缓冲时间的大小,以毫秒为单位。 回传 无回传值 Example 函式库参考主页面 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.



  • SoftwareSerial Library

    SoftwareSerial Library

    86Duino 内建支援序列介面在脚位 0 和 1。内建的序列介面由包含在 86Duino CPU 裡的晶片产生,叫做 UART。因为有这个 UART 晶片提供序列介面,让 86Duino 的 CPU 在处理其他运算时,也可以接收序列介面的输入。 SofrwareSerial 函式库提供把一般的数位脚位作为序列介面的功能,用软体的方式提供和硬体序列介面相同的功能。如果需要产生反向的序列讯号,在初始化时可以利用参数来设定,使得序列介面的输出为反向。 SoftwareSerial 函式库从 86Duino Coding 103 开始支援。 限制 SofrwareSerial 函式库有以下已知的限制: 如果使用多个软体序列介面,同时间只有一个可以接收资料。 86Duino 并不是每一个数位脚位都支援中断,所以只有以下的数位脚位可以作为 RX 信号脚位: 18, 19, 20, 33, 34, 35, 36, 37, 38, 42, 43, 44. 鲍率最高支援到 19200 bps 范例 函式 - SoftwareSerial() - available() - begin() - […]


  • SoftwareSerial: write(data)

    SoftwareSerial: write(data)

    描述 透过软体序列介面传送资料。运作方式与 Serial.write() 相同。 参数 详情请看 Serial.write() 回传 byte:write() 会回传传送资料的位元组数量 范例 See also - SoftwareSerial() - begin() - print() - println() 函式库参考主页面 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 […]


  • SoftwareSerial: listen()

    SoftwareSerial: listen()

    描述 指定要监听的软体序列介面。一次只能有一组软体序列介面被监听,没有被监听的软体序列介面其所接收到的资料都会被销毁。预设监听的软体序列介面为最后一个呼叫 begin() 的软体序列介面。 语法 mySerial.listen() 参数 mySerial:要被监听的软体序列介面 回传 无回传值 范例 See also - SoftwareSerial() - begin() - read() - print() - println() 函式库参考主页面 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 […]