I’ve been having trouble printing IME or quadrature sensor data to the brain screen. I’m trying to use .position(degrees) to find the rotation of the encoders after it was last reset, but the printed value once changed from zero is a huge integer as if every change to the encoder prints the result of an int random number generator (positive and negative). It’s in no way related to the actual number of degrees rotated.
Initially I just ignored the problem because I could tell the sensors were functioning properly through autonomous tests, but now I’m working with my lift motor encoder and I’m having trouble debugging it without the data.
Please post your code (remember to wrap it in [code]…[/code] tags), otherwise it’s difficult to tell what’s happening.
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// Controller1 controller
// LiftMotor motor 5
// ArmMotor motor 6
// IntakeMotor motor 7
// StackerMotor motor 8
// LeftQuad encoder A, B
// RightQuad encoder C, D
// BarPot pot H
// StackBumper bumper G
// Controller2 controller
// LeftBackMotor motor 1
// RightBackMotor motor 2
// LeftFrontMotor motor 3
// RightFrontMotor motor 4
// ---- END VEXCODE CONFIGURED DEVICES ----
using namespace vex;
Brain.Screen.printAt(1, 20, "in loop, we are at %d",LiftMotor.position(turns));
EDIT: yes, the loop is in the main function…
%d is used to indicate a signed decimal integer(whole number).
Use %f to indicate a floating point number.