| aWWDefs.tea | Index |
This file contains mode codes and default defined values for use with the Wheel Watcher. This device may be attached to a servo. It provides quadrature encoder outputs that can be used to determine servo position. A typical application of the Wheel Watcher is to use a pair of them to provide feedback for two modified servos mounted on a differentially steered robot base. The aWWEnc.tea program may be launched as a separate process that continually monitors encoder input.
If necessary, a user can edit this file to change the IO assignments, but this is not recommended.
Mode Codes
| AWWDEFS_A_AND_B | 0 | Mode code for doing 32 counts per revolution. Uses channels A and B as inputs. |
| AWWDEFS_B_AND_DIR | 1 | Mode code for doing 64 counts per revolution. Uses DIR and channel B as inputs. |
| AWWDEFS_QUADCT_AB | 2 | Mode code for doing 128 counts per revolution. Uses channels A and B as inputs. |
Default Defined Values
| AWWDEFS_LMO_SERVO | 0 | Index of output used to drive right servo. |
| AWWDEFS_RMO_SERVO | 1 | Index of output used to drive right servo. |
| AWWDEFS_LMO_DIR | 1 | Index of digital IO pin used for left direction input. |
| AWWDEFS_LMO_CHA | 1 | Index of digital IO pin used for left channel A input. |
| AWWDEFS_LMO_CHB | 2 | Index of digital IO pin used for left channel B input. |
| AWWDEFS_RMO_DIR | 3 | Index of digital IO pin used for right direction input. |
| AWWDEFS_RMO_CHA | 3 | Index of digital IO pin used for right channel A input. |
| AWWDEFS_RMO_CHB | 4 | Index of digital IO pin used for right channel B input. |
| AWWDEFS_LMO_ENC | 28 | Index of 2-byte scratchpad location used to store left encoder tally. |
| AWWDEFS_RMO_ENC | 30 | Index of 2-byte scratchpad location used to store right encoder tally. |
Example:
(Load aWWEnc.tea file in file slot 1)
(Load the following TEA file in file slot 0)
#include <aMulti.tea>
#include <aPrint.tea>
#include <aPad.tea>
#include <aWWDefs.tea>
void main()
{
aMulti_Spawn(1,3);
aMulti_Signal(3,AWWDEFS_QUADCT_AB);
while (1) {
aPrint_IntDec(aPad_ReadInt(AWWDEFS_LMO_ENC));
aPrint_Char(',');
aPrint_IntDec(aPad_ReadInt(AWWDEFS_RMO_ENC));
aPrint_Char('\n');
aCore_Sleep(2500);
}
}
This program (stored as program 0) spawns program 1 as process 3. Program 1 is the aWWEnc.tea program. The aWWEnc.tea program waits for a signal sent by semaphore to determine what mode to use for counting. Once it receives the signal, it starts monitoring the encoders. Then an infinite loop prints the current encoder values. A user can send manual servo commands from the Console to make the motors start spinning.
Related: