Articles Posted in the " " Category

  • isMoving()

    isMoving()

    描述 回报伺服机是否正处于转动状态。 语法 servo.isMoving() 参数 servo:Servo 型别的变数。 回传 若伺服机正在转动,回传 true;其他状况下(如:伺服机暂停、停止、释放或已到达目标位置)则回传 false。 范例 See also - write() - writeMicroseconds() - setPosition() - run() - pause() - resume() - stop() - release() 函式库参考主页面 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 […]


  • servoMultiRun()

    servoMultiRun()

    描述 同时命令多颗伺服机转动至它们的目标位置。(此函式行为等同对每一颗指定的伺服机呼叫 run()。) 呼叫 servoMultiRun() 后,您的程式可以去做其他事情,转动伺服机的工作会在背景执行,如果想知道伺服机是否转到目标位置,可以呼叫 isServoMultiMoving() 来检查。 语法 servoMultiRun() servoMultiRun(servo1) servoMultiRun(servo1, servo2) servoMultiRun(servo1, servo2, ... , servo45) 参数 servo1 ~ servo45:Servo 型别的变数。 您可以输入 1 ~ 45 个 Servo 型别的参数,指定要一起转动的多颗伺服机;您也可以不输入任何参数,当没有输入参数的时候,代表所有已经 attach() 的伺服机都要同时转动。 回传 范例 See also - attach() - setPosition() - run() - isServoMultiMoving() 函式库参考主页面 The text of the 86Duino reference is licensed under […]



  • stop()

    stop()

    描述 停止伺服机的转动。 呼叫此函式后,伺服机会在当前的位置上立即停止。此函式的行为和 pause() 不同,您无法透过 resume() 让伺服机恢复转动,必须重新设定目标位置并呼叫 run(),或者呼叫 write() 或 writeMicroseconds() 才能让伺服机再次转动。 请注意,伺服机在停止状态仍会出力,此时请勿用手大力转动伺服机,否则容易造成伺服机损坏。 语法 servo.stop() 参数 servo:Servo 型别的变数。 回传 范例 See also - setPosition() - run() - pause() - resume() 函式库参考主页面 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 […]


  • resume()

    resume()

    描述 使暂停中的伺服机继续转动。 语法 servo.resume() 参数 servo:Servo 型别的变数。 回传 范例 See also - setPosition() - run() - pause() 函式库参考主页面 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.


  • pause()

    pause()

    描述 暂停伺服机的转动。 请注意,暂停后的伺服机仍会出力,请勿用手大力转动,否则容易造成伺服机损坏。若要使暂停的伺服机继续转动,请呼叫 resume()。 语法 servo.pause() 参数 servo:Servo 型别的变数。 回传 范例 See also - setPosition() - run() - resume() 函式库参考主页面 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.


  • run()

    run()

    描述 命令伺服机转动至 setPosition() 设定的目标位置。 呼叫 run() 后,您的程式可以去做其他事情,转动伺服机的工作会在背景执行,如果想知道伺服机是否转到目标位置,可以呼叫 isMoving() 或 isServoMultiMoving() 来检查。 请注意,当伺服机处于脱力状态时,此函式将会让伺服机立即出力,此时请避免以手大力转动伺服机,以免受伤或使伺服机损坏。 语法 servo.run() 参数 servo:Servo 型别的变数。 回传 范例 See also - setVelocity() - setPosition() 函式库参考主页面 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.


  • readMicroseconds()

    readMicroseconds()

    描述 读取伺服机目前角度。 语法 servo.readMicroseconds() 参数 servo:Servo 型别的变数。 回传 伺服机目前的角度(型别为 unsigned long 整数),如果伺服机尚未出力,回传值为 0。(单位:us) 范例 See also - write() - writeMicroseconds() - read() 函式库参考主页面 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 […]


  • writeMicroseconds()

    writeMicroseconds()

    描述 设定伺服机目标角度,并且让伺服机转动至目标角度。 请注意,呼叫此函式后会让伺服机立即出力,请避免以手大力转动伺服机,以免受伤或损坏伺服机。 语法 servo.writeMicroseconds(position) 参数 servo:Servo 型别的变数。 position:目标角度,单位:us。 回传 范例 See also - write() - read() - readMicroseconds() - setVelocity() 函式库参考主页面 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 […]


  • setPosition()

    setPosition()

    描述 设定呼叫 run() 时,伺服机的目标位置。 语法 servo.setPosition(position) servo.setPosition(position, time) 参数 servo:Servo 型别的变数。 position:伺服机目标位置,可输入整数和浮点数型别的数值。当输入整数时,目标位置的单位是 us,例如输入 1500,代表对应 PWM 脉波为 1500us 的伺服机位置。当输入的是符点数时,目标位置的单位是度,例如输入 90.0,代表伺服机的 90 度位置。 time(可选):指定伺服机从当前位置转动到目标位置的期望花费时间。若输入值为 0,则伺服机将会以最快速度转动;若没有输入值,则伺服机将会根据 setVelocity() 设定的速度转动。 回传 范例 See also - setVelocity() - run() 函式库参考主页面 The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference […]