diff --git a/encoder.java b/encoder.java new file mode 100644 index 0000000..7527188 --- /dev/null +++ b/encoder.java @@ -0,0 +1,6 @@ +DcMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); // tare the encoder + +// in opMode: +int pos_to_go = ...; // position to go +DcMotor.setTargetPosition(pos_to_go); // set target position, the motor will run to this pos +DcMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION); // mode run to position