The Servo service is used to control servos through a micro-controller such as an Arduino or a Raspberry pi (ServoController).
The service will allow to control attaching or detaching the device, control his position and the speed at wich it move to that position, and turn off/on the servo.
servo.attach(controller, pin, pos, velocity): Initial servo device attachement to the microcontroller
servo.detach(controller): detach the servo from the microcontroller
servo.enable(): will turn the servo motor on
servo.disable(): will turn the servo motor off
servo.moveTo(pos): ask the servo to move to a position
servo.moveToBlocking(pos): ask the servo to move to a position and wait the position reached
servo.map(inputMin, inputMax, outputMin, outputMax): default to (0,180, 0, 180). Allow to map a range to a valid output range that can be understand by the servo. The outputMin and outputMax must have value between 0 and 180.
servo.setInverted(true/false): Reverse the direction of rotation of the servo.
Look at sample script bellow for others commands !
Connect the signal wire to a pin on the controller
Connect the (+) wire to the (+) of a power source (battery or power supply)
Connect the (-) wire to the ground of a power source AND the ground of the controller
Servo needs a lot of current and require to be connect to a power source that can provide enough current. The controllers (Arduino or Raspberry pi) are not strong enough to make the servo work properly and you should avoid connecting the 5V of the controller to the servo.
servo.setVelocity(degree/s): Will force the servo to rotate at the specify velocity. If the speed specify is faster than the servo capability, the servo will turn at a lower speed than expected. The value -1 will bypass the speed control and have the servo rotate normally.
This is a common Servo service. All simple Servos need to attach to a ServoController. Currently, the list of ServoControllers are :
The Servo needs a controller in order to operate. You should be able to select one in the drop down. Select the correct signal pin the servo is attached to. Then select "attach" and the servo should be controllable with the slider bar. Limits can be set in order to protect the servo from going beyon a certain minimum and maximum value.
Modular Block Diagram showing the differences of sweeping a Servo from MyRobotLab versus sweeping it from the microcontroller (Arduino)