| aWWEnc.tea | Index |
This file may be compiled, loaded, and launched as a separate process that continually monitors the encoder input from a Wheel Watcher. The Wheel Watcher may be attached to a standard-sized 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 aWWDefs.tea file contains default defined values for the IO assignments associated with a pair of Wheel Watchers. If necessary, a user can edit this file to change these assignments, but this is not recommended.
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: