back to AnalogEncoder
Description
This function is used to reset the counts to zero for an AnalogEncoder object.
Parameters
None.
Returns
None.
Examples
#include <FEHIO.h> #include <FEHMotor.h> #define LOW_THRESH 0.15 #define HIGH_THRESH 2.20 int main(void) { //declares an analog encoder on P0_3 AnalogEncoder right_encoder(FEHIO::P0_3); //set the analog encoder threshold right_encoder.SetThresholds( LOW_THRESH, HIGH_THRESH ); //declares a motor on motor port 0 FEHMotor right_motor(FEHMotor::Motor0); //turn on the right motor to 75% power right_motor.SetPercent( 75.0 ); //ensure that the encoder counts are at zero by resetting right_encoder.ResetCounts(); //wait until the right encoder reaches 500 counts while(right_encoder.Counts() < 500); //stop the motor right_motor.Stop(); }