pre_auton Question

[FONT=“Times New Roman”][/FONT]I’m making an autonomous that only works in one place when it starts off. So I’m planning on attaching a potentiometer so that when it’s turned one way by a person before they place it, it can know where to go. If what I said is confusing I’ll put it in a different way.

If the POT is at, for example, 4000 or above, the robot will move to the left.
If the POT is at 20 or below, the robot will move to the right.

Can this be done in pre_auton?
Is there something can be activated by a sensor (1 or 0)?
:confused::confused::confused:
Please help, competition not that far from whenever I posted this.

Yes, I think so. Using a pot like this is a common way to select an autonomous. You might want to make sure there is some sort of mechanical way to help hold the pot in whatever position you select.

Check out this: https://www.youtube.com/watch?v=2nsJ9RqT_G0

You might have a look at this link (ignore the chit-chat about LCDs, though.)
https://vexforum.com/showthread.php?p=368076

Are you talking about something like a bumper switch or limit switch?

Yes it can be done in pre_auton. You will have to have variables of global scope.

I recommend a function to read these because you can also call that same function in auton and user control loops.

Potentiometer gives you multiple ranges of choices
Jumpers allow for 1/0 binary switches. Using multiple jumpers increases the options.

Using either of these with LED lights gives you feedback to know what is currently set.

For the jumper example, have a jumper in a slot to be red/blue indicator. Have a red LED light up when you are the red team. Off would be the blue team. Use a second jumper and second LED of a different color for the post vs skyrise start block. Downside is you just used 4 digital ports.

For the potentiometer example. have the LEDs light up based upon what range you are in. This uses one analog port and 2 digital ports.

You could do the same thing with the LCD display but those are more expensive to buy.

I think I figured it out, I used:
setProgramNumber(1);
setProgramNumber(2);

if(programNumber == 1)
{
}

else if(programNumber == 2)
{
}

2 things 1 is that how do you make a new thread 2 is my pneumatics program isn’t working can you give me an example

First, log in with your username and password. If you are reading this, then go to the top of this page to the red link entitled General Forum. Click on that. It will take you to a new page where you will see a blue-ish button near the top left labeled New Thread. Click on that and away you go. :slight_smile:

You will need to let the forum members know what type of programming language you are using and what sort of pneumatics (double or single action, etc.). Also, if you can, perhaps post what code you might have so we can look for problems.