Servo.read

Name
servo.read

Description
This function returns the current position value of the specified servo.


 * Since: Beta 32X, release 323.


 * Warning!: Servo library uses PIC's Timer1 (TMR1). So, be aware of that in case you plan to use a timer in your application. Otherwise you could disrupt servo library.

Syntax

 * pin : Value: Check valid values according to board : [Servo library supported boards]
 * Argument type: unsigned char


 * Output: Function returns a degrees value in a range from 0 to 180.
 * Argument type: unsigned char

Example
The following example defines pin 15 as servo driver.

In the loop, position of servo(pin 15) will be modified from 0 to 150 degrees every half second. When the read value set to servo will be 150 degrees, position value will be reset to 0.

Connectivity diagram is shown within the code comments.