Show
Ignore:
Timestamp:
08/06/08 13:25:02 (5 months ago)
Author:
liamstask
Message:

- add examples to motor doc

Files:
1 modified

Legend:

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

    r704 r786  
    5151Other output devices cannot be used simultaneously - for example, the DigitalOuts cannot be called without 
    5252first setting overlapping the DC motor I/O lines to inactive. 
     53 
     54See the digital out section of the  
     55<a href="http://www.makingthings.com/documentation/tutorial/application-board-overview/digital-outputs"> 
     56Application Board overview</a> for more details. 
    5357\ingroup Libraries 
    5458@{ 
     
    6064  @param state An integer specifying the availability of the motor's I/O lines - 1 (active) or 0 (inactive). 
    6165  @return Zero on success. 
     66   
     67  \b Example 
     68  \code 
     69  // Enable motor 0 
     70  Motor_SetActive(0, 1); 
     71  \endcode 
    6272*/ 
    6373int Motor_SetActive( int index, int state ) 
     
    7686  @param index An integer specifying which DC Motor (0-3). 
    7787  @return The availability of the motor's I/O lines - 1 (active) or 0 (inactive). 
     88   
     89  \b Example 
     90  \code 
     91  if( Motor_GetActive(0) ) 
     92  { 
     93    // Motor 0 is active 
     94  } 
     95  else 
     96  { 
     97    // Motor 0 is inactive 
     98  } 
     99  \endcode 
    78100*/ 
    79101int Motor_GetActive( int index ) 
     
    89111  @param duty An integer (0 - 1023) specifying the speed. 
    90112  @returns Zero on success. 
     113   
     114  \b Example 
     115  \code 
     116  // Set the speed of motor 3 to %75 
     117  Motor_SetSpeed(3, 768); 
     118  \endcode 
    91119*/ 
    92120int Motor_SetSpeed( int index, int duty ) 
     
    114142  @param forward A character specifying direction - 1/non-zero (forward) or 0 (reverse). 
    115143  @return Zero on success. 
     144   
     145  \b Example 
     146  \code 
     147  // Set the direction of motor 2 to reverse. 
     148  Motor_SetDirection(2, 0); 
     149  \endcode 
    116150*/ 
    117151int Motor_SetDirection( int index, char forward ) 
     
    138172  @param index An integer specifying which DC Motor (0-3). 
    139173  @return the speed (0 - 1023) 
     174   
     175  \b Example 
     176  \code 
     177  // check the current speed of motor 1 
     178  int motor1_speed = Motor_GetSpeed(1); 
     179  \endcode 
    140180*/ 
    141181int Motor_GetSpeed( int index ) 
     
    159199  Read the direction of a DC motor. 
    160200  @param index An integer specifying which DC Motor (0-3). 
    161   @return Direction - 1/non-zero (forward) or 0 (reverse). 
     201  @return Direction - non-zero (forward) or 0 (reverse). 
     202   
     203  \b Example 
     204  \code 
     205  if( Motor_GetDirection(0) ) 
     206  { 
     207    // Motor 0 is going forward 
     208  } 
     209  else 
     210  { 
     211    // Motor 0 is going in reverse 
     212  } 
     213  \endcode 
    162214*/ 
    163215int Motor_GetDirection( int index )