Changeset 786 for firmware/trunk/libraries/motor/motor.c
- Timestamp:
- 08/06/08 13:25:02 (5 months ago)
- Files:
-
- 1 modified
-
firmware/trunk/libraries/motor/motor.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
firmware/trunk/libraries/motor/motor.c
r704 r786 51 51 Other output devices cannot be used simultaneously - for example, the DigitalOuts cannot be called without 52 52 first setting overlapping the DC motor I/O lines to inactive. 53 54 See the digital out section of the 55 <a href="http://www.makingthings.com/documentation/tutorial/application-board-overview/digital-outputs"> 56 Application Board overview</a> for more details. 53 57 \ingroup Libraries 54 58 @{ … … 60 64 @param state An integer specifying the availability of the motor's I/O lines - 1 (active) or 0 (inactive). 61 65 @return Zero on success. 66 67 \b Example 68 \code 69 // Enable motor 0 70 Motor_SetActive(0, 1); 71 \endcode 62 72 */ 63 73 int Motor_SetActive( int index, int state ) … … 76 86 @param index An integer specifying which DC Motor (0-3). 77 87 @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 78 100 */ 79 101 int Motor_GetActive( int index ) … … 89 111 @param duty An integer (0 - 1023) specifying the speed. 90 112 @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 91 119 */ 92 120 int Motor_SetSpeed( int index, int duty ) … … 114 142 @param forward A character specifying direction - 1/non-zero (forward) or 0 (reverse). 115 143 @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 116 150 */ 117 151 int Motor_SetDirection( int index, char forward ) … … 138 172 @param index An integer specifying which DC Motor (0-3). 139 173 @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 140 180 */ 141 181 int Motor_GetSpeed( int index ) … … 159 199 Read the direction of a DC motor. 160 200 @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 162 214 */ 163 215 int Motor_GetDirection( int index )
