Show:

BO.io.Servo Class

Defined in: src/io/Servo.js:21

Creates an interface to a Servo motor. Use this object to set the angle of the servo head. You can simply specify and angle between 0 and 180 degrees and the servo head will rotate to that angle. See Breakout/examples/actuators/servo.html for an example application. You can also use this with a continuous rotation servo. See the description for the angle property for use with a continuous rotation servo.

Constructor

BO.io.Servo

(
  • board
  • servoPin
  • minAngle
  • maxAngle
)

Defined in src/io/Servo.js:21

Parameters:

  • board IOBoard

    A reference to the IOBoard instance that the servo is attached to.

  • servoPin Pin

    A reference to the Pin the servo is connected to.

  • minAngle Number

    The minimum angle the server can rotate to (default = 0).

  • maxAngle Number

    The maximum angle the server can rotate to (default = 180).

Item Index

Properties

Properties

angle

Number

Defined in src/io/Servo.js:60

Set the angle (in degrees) to rotate the server head to.

If you are using a continuous rotation servo, a value of 90 will stop the servo. A value of 0 (or < 90 depending on the servo) will cause continous clockwise rotation and a value of 180 (or > 90) will cause continuous counter-clockwise rotation. If your motor does not come to a full stop when setting 90 degrees, you will need to adjust the servo (there is typically a screw on the motor) to adjust

Servo.COEF_TO_0_180

Unknown static

Defined in src/io/Servo.js:90

The scale to convert 0-1 (0-255 in 8bit) to 0-0.706 (0-180 in 8bit).