jumpers with robotc

OK, so i thought it would be a good idea for our team if we had multiple autonomous programs that did different things, and we could choose which one we wanted to use just before the match, so to tell the robot which one to use, i wanted to use jumpers. Well, i couldn’t figure out how to check if there was a jumper in one of the ports with robotC, so i looked it up, i searched all over the vex forum and also on the web, but couldn’t find anything, so finally i just opened our easyC program from last year that could do this, well, i looked at the C code that it generated from the blocks, and tried to copy it into robotC, and mess around with it so it would work, and this is what i got:

int jumper5 = 1;
int jumper6 = 1;

jumper5 = in5;
jumper6 = in6;

if(jumper5 == 0) //jumper test, if a jumper is in 5…
Forwards(0, 1000); //drive forwards for 1 second

i haven’t gotten a chance to test it out yet, but i will tonight, just wondering if anyone out there knew about this. Please let me know if I’m right or not, and if not, what i need to do, thanks! :slight_smile:

ok, well i never really got a chance to test it as we had a lot of work to get done on our robot before our competition (this Saturday, yes, Halloween), and it doesn’t look like anyone had a clue what i should do, haha, well, i might have a chance to test it out on Friday, but i don’t think i will even need it for the competition because as of now, we don’t even have 1 working autonomous program! :slight_smile: and only with luck will we get that 1 working, well, im just happy our robot is up and running now :smiley:

We’ll see you there. We drove our robot for the first time last night. We’ll try for an autonomous program tonight.

haha, you sound just like us, for the first time ever we were able to actually drive around, pick up balls, and score them, :slight_smile: looking forward to seeing you there! :smiley: actually they had our 2nd robot working quite nicely a few weeks ago, even though we started working on that one later than this one, haha

i take it that no one has enough sufficient knowledge of robotc to help me here

Hm…I went searching for an answer on how to program a jumper in robotC and I came up a bit short…basically I didn’t find anything.

If you have space, you might want to consider a button? For example. You have button 1.

When the button is pressed, it runs one autonomous code, and when it is not pressed, it runs a different autonomous code. The pressed state can be achieved by wrapping the sensor in a competition legal rubber band or with a zip tie before the start of the match.

We havent tried jumpers, but a potentionmeter works great to choose different portions of code.

Although I have not used RobotC your code looks correct to me, because the VEX Controller automatically pulls the inputs to +5 Volts (logic 1), so that when you jumper the input to ground the selected input pin the value changes to 0 as your conditional statement in your Robot C example shows.

just a quick note
is a jumper the same thing as a pushed down button?

Yes - exactly the same.
[INDENT]Pressed button = installed jumper
Released button = open port.

This is true in all of the programming environments because they are electrically identical - there is no way for software to distinguish between a pressed button and an installed jumper.


  • Dean

Hey, I haven’t checked this thread in a while, for some reason I wasn’t finding out that people were posting here. Anyway, I found something in robotC in the “motors and sensors setup”, there is a “sensor” that can be plugged in to the A/D (Analog/Digital) ports on the VEX microcontroller, the “sensor” is called “Digital In”. I’m guessing that “Digital In” is meant for using jumpers, but I’m not sure, I will have to try it as soon as I can, I should be able to at our meeting in 2 weeks.

Ok, I was able to successfully use the “Digital In” “sensor” for jumpers at our last competition, but unfortunately, was not able to put it to use, because we had trouble trying to put the jumpers in and scratched the idea. It appears that the jumpers only work in A/D (Analog/Digital) ports 1-8, and not in 9-16, because when I tried using 15 and 16, nothing happened, maybe some others can do some more testing, but I believe if anything, we will be using touch sensors instead.

You have to set whether each port is an analog, digital in, or digital out. In EasyC, you can set them by pressing F5; in RobotC, there is also a port configuration window.

To alleviate the problem of jumpers being very difficult to put in, we just ran short extension wires and labeled them. It’s much easier to put the jumper in when you can see the pin-holes.

Oh! That’s a neat idea! Thanks for sharing that with me, I think I will try that next meeting. :slight_smile:

Yes I did this, but it still did not work in 15 and 16 A/D ports.

I think in RobotC, digital ports should be in lower positions than analog ports. At least, it warns me about that when I try to do it.

One of the teams we allied with last year at the championships (robowranglers or simbotics) made a knob out of vex parts for a potentiometer mounted on the robot, and marked about 10 different positions around it. They programmed this to select different autonomous modes. I have had jumpers working in the higher ports, but as fryfrog says, they have to be in lower positions than the analog inputs.

That was 1114A, your first pick.

You can find an upload I made a couple of weeks ago that contains details as well as EasyC code on writing a multi-autonomous program for your competition robot. Multi-autonomous programming made simple My preference is to use limit switches rather than jumpers but that is certainly a matter of choice.