Sensors for Driver Control

Im trying to program my sensors to read and do what their suppose to do but while in driver control. I can program the bumper/limit switch to turn the robot on and off and to put a delay what pressed but im trying to use the quad encoder or the potentiometer during driver control. i want to be able to just press a button on the joystick and the arm will move up or down according to the sensor. im programming with V4. thanks

That is an admirable goal. Keep us informed as to your progress.
You may also find useful examples and similar discussions in the forum history,
by using the search feature of the forum.

What are your exact intentions? I use the shaft encoders to drive fairly straight in driver control (we are able to strafe) and I use the potentiometers to raise/lower the arm to certain points.

Basically, the logic is: if the button is pressed → do certain function
To go into detail, the do certain function with potentiometers would be if/while(depends on the program) the potentiometer value is less than/greater than/not equal → do certain function

The driving straight is fairly simple. Pseudo:

 if(transmittervalue > 100){ // what you use for your drive
if(leftencodervalue > rightencodervalue){
make left drive less, right drive more

My potentiometer functions allow the arm to be raised to a point regardless of where it is. I honestly can’t type this now, but I’ll gladly create a snippet/sample code for you if you want.

a sample program would be great. wer trying to use it to stop the arm before if maxes out so the square bars dont torque

Oooh, limits. I see. The pseudo would be:

if(armpotentiometervalue > certain number){ 
/* the greater than, less than can be changed, according to how the potentiometer reads, certain number is the limit that can be found via online code. (EasyC V2, no idea about EasyC V4) */

That was how I did it before. However, mechanical stops work too.

1 Like

Posts 7 & 8 in this thread describe a solution to something similar to what you’re trying to do. You could easily use a potentiometer reading past a certain value, rather than a sensor (limit or bumper) being pressed, as the condition for enabling/disabling a channel on the joystick.

1 Like