Exemplo n.º 1
0
//=============================================================================
// 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 Servo8Bit::read()
{
    //make sure we have a valid servo number. If it's invalid then exit doing nothing.
    if(myServoNumber == invalidServoNumber) return 0;

    uint16_t servoPulseLengthInUs = readMicroseconds();
    uint16_t servoPositionInDegrees = map(servoPulseLengthInUs, myMin, myMax, 0, 180);
    return servoPositionInDegrees;
}//end read
Exemplo n.º 2
0
int Servo::read() // return the value as degrees
{
    // read returns the angle for an assumed 0-180, so we calculate using 
    // the normal min/max constants and not user defined ones
    return improved_map(readMicroseconds(), MIN_PULSE_WIDTH, MAX_PULSE_WIDTH, 0, 180);
}
Exemplo n.º 3
0
int Servo::read() // return the value as degrees
{
  return map(readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
}
Exemplo n.º 4
0
int Servo::read() // return the value as degrees
{
	return map(readMicroseconds(), MIN_PULSE, MAX_PULSE, 0, 180);
}
Exemplo n.º 5
0
int Servo::read() // return the value as degrees
{
    return map(readMicroseconds(), _minUs, _maxUs, 0, 180);
}