resources/libtiny/Servo.cpp
//=============================================================================
// FUNCTION:    uint16_t read()
//
// DESCRIPTION: Gets the last written servo pulse width as an angle between 0 and 180.
//
// INPUT:       Nothing
//
// RETURNS:     Angle between 0 and 180
//
//=============================================================================
uint16_t read()
DESCRIPTION: Gets the last written servo pulse width as an angle between 0 and 180.

Nothing

Angle between 0 and 180
uint16_t read () DESCRIPTION : Gets the last written servo pulse width as an angle between 0 and 180 . Nothing Angle between 0 and 180
uint16_t Servo::read()
{
    if(servoIndex == INVALID_SERVO) return 0;
    uint16_t servoPulseLengthInUs = readMicroseconds();
    uint16_t servoPositionInDegrees = map(servoPulseLengthInUs, min, max, 0, 180);
    return servoPositionInDegrees;
}
uint16_t Servo :: read ( ) { if ( servoIndex == INVALID_SERVO ) return 0 ; uint16_t servoPulseLengthInUs = readMicroseconds ( ) ; uint16_t servoPositionInDegrees = map ( servoPulseLengthInUs , min , max , 0 , 180 ) ; return servoPositionInDegrees ; }
FUNCTION:    uint16_t read()
DESCRIPTION: Gets the last written servo pulse width as an angle between 0 and 180.
FUNCTION : uint16_t read () DESCRIPTION : Gets the last written servo pulse width as an angle between 0 and 180 .
//make sure we have a valid servo number. If it's invalid then exit doing nothing.