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!
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! and only with luck will we get that 1 working, well, im just happy our robot is up and running now
haha, you sound just like us, for the first time ever we were able to actually drive around, pick up balls, and score them, looking forward to seeing you there! 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
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.
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.
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.
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.
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.