Servo library

This library allows an 86Duino board to control RC (hobby) servo motors. Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.

The Servo library supports up to 45 motors on 86Duino boards, and has an improved implementation, in contrast with the original Servo library of Arduino Uno and Mega 2560, to generate stable servo-command pulses no matter how many motors are controlled (see 此頁面 for more details). Note that use of the library disables analogWrite() (PWM) functionality, whether or not there is a Servo on those pins.

Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and, in the case of 5V-powered servo motors, may be connected to the 5V pin on the 86Duino board. The ground wire is typically black or brown and should be connected to a ground pin on the 86Duino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the 86Duino board. Note that servos draw considerable power, so if you need to drive more than one or two, you’ll probably need to power them from a separate supply (i.e. not the +5V pin on your 86Duino). Be sure to connect the grounds of the 86Duino and external power supply together.

Functions

Limits

The Servo library employs the internal timer that are also used by both the TimerOne 以及 Servo86 libraries; so to avoid conflicts, one should avoid calling these libraries at the same time.

範例

The following are examples of the Servo library from the Arduino Tutorial that can work on the 86Duino boards:

  • Knob: control the shaft of a servo motor by turning a potentiometer.
  • Sweep: sweeps the shaft of a servo motor back and forth.

演示影片


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール