crazyasebo.blogg.se

Vex limit switch code robotc
Vex limit switch code robotc













vex limit switch code robotc

Int rightEncoder = abs(nMotorEncoder) // leftEncoder)īy adding the two lines inside the while loop, now you are checking and updating the encoder counts every time you step into a new loop. So, that said, try using the following: void GOforwards() I don't know about VEX robotics, but I'll caution you that your left and right encoders are based on nMotorEncoder and, just like how leftEncoder and rightEncoder doesn't get updated anywhere in your loop, nMotorEncoder doesn't get updated anywhere either. The exception might be if those variable names are actually protected variable names that have special meaning in your development environment - more on that later.

VEX LIMIT SWITCH CODE ROBOTC UPDATE

The problem seems to be that maybe you're thinking that the left and right encoder values will update automatically, but that is generally not the case. It looks like you don't ever update the encoder values after you initialize them. much less why it runs off into oblivion when the code should exit the while loop once the right encoder's absolute value exceeds 2000. I am not sure why the power to the wheels never changes, or why it seems to believe that the Encoder values are equal. This is a video of the code running from the debugger windows: When I run the code my robot runs without stopping and the Encoder values diverge quickly. *!!Code automatically generated by 'ROBOTC' configuration wizard !!*// #pragma config(Motor, port10, rightMotor, tmotorVex393_HBridge, openLoop, reversed, driveRight, encoderPort, I2C_2) #pragma config(Motor, port1, leftMotor, tmotorVex393_HBridge, openLoop, driveLeft, encoderPort, I2C_1) #pragma config(Sensor, I2C_2,, sensorQuadEncoderOnI2CPort,, AutoAssign ) #pragma config(Sensor, I2C_1,, sensorQuadEncoderOnI2CPort,, AutoAssign ) This is my code: #pragma config(I2C_Usage, I2C1, i2cSensors)

vex limit switch code robotc vex limit switch code robotc

I have a standard VEX Clawbot, which I've been trying to make go straight for some time.















Vex limit switch code robotc