Changeset 788

Show
Ignore:
Timestamp:
08/06/08 13:40:24 (3 months ago)
Author:
liamstask
Message:

- adding examples to servo doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • firmware/trunk/libraries/servo/servo.c

    r771 r788  
    106106  You can also specify the speed with which the motors will respond to new position commands - a high 
    107107  value will result in an immediate response, while a lower value can offer some smoothing when appropriate. 
     108   
     109  See the servo section in the <a href="http://www.makingthings.com/documentation/tutorial/application-board-overview/servos"> 
     110  Application Board overview</a> for more detailed info. 
    108111* \ingroup Libraries 
    109112* @{ 
     
    116119  @param state An integer specifying the active state - 1 (active) or 0 (inactive). 
    117120  @return Zero on success. 
     121   
     122  \b Example 
     123  \code 
     124  // enable servo 2 
     125  Servo_SetActive(2, 1); 
     126  \endcode 
    118127*/ 
    119128int Servo_SetActive( int index, int state ) 
     
    152161  @param index An integer specifying which servo (0-3). 
    153162  @return State - 1 (active) or 0 (inactive). 
     163   
     164  \b Example 
     165  \code 
     166  if( Servo_GetActive(2) ) 
     167  { 
     168    // Servo 2 is active 
     169  } 
     170  else 
     171  { 
     172    // Servo 2 is inactive 
     173  } 
     174  \endcode 
    154175*/ 
    155176int Servo_GetActive( int index ) 
     
    177198  @param position An integer specifying the servo position (0 - 1023). 
    178199  @return status (0 = OK). 
     200   
     201  \b Example 
     202  \code 
     203  // set servo 1 to midway through the "safe" range 
     204  Servo_SetPosition(1, 512); 
     205  \endcode 
    179206*/ 
    180207int Servo_SetPosition( int index, int position ) 
     
    206233  @param speed An integer specifying the servo speed (0 - 1023). 
    207234  @return status (0 = OK). 
     235   
     236  \b Example 
     237  \code 
     238  // set servo 1 half speed 
     239  Servo_SetSpeed(1, 512); 
     240  \endcode 
    208241*/ 
    209242int Servo_SetSpeed( int index, int speed ) 
     
    229262  @param index An integer specifying which servo (0 - 3). 
    230263  @return The position (0 - 1023), or 0 on error. 
     264   
     265  \b Example 
     266  \code 
     267  int srv0_pos = Servo_GetPosition(0); 
     268  // now srv0_pos is the current position 
     269  \endcode 
    231270*/ 
    232271int Servo_GetPosition( int index ) 
     
    244283  @param index An integer specifying which servo (0 - 3). 
    245284  @return The speed (0 - 1023), or 0 on error. 
     285   
     286  \b Example 
     287  \code 
     288  int srv0_speed = Servo_GetSpeed(0); 
     289  // now srv0_speed is the current speed 
     290  \endcode 
    246291*/ 
    247292int Servo_GetSpeed( int index )