Toll booth challenge help ;(

I need help with my robotc toll booth challenge. I have no idea how to code and my teacher didn’t bother teaching, she just expected us to know. The language we’re using is natural language pltw and we can only use one motor and a bump switch and the arm of the toll booth can only move up and down at a 90° can anyway please help me with this code ??

Can you give more of a description of the program? Like your car needs to bump the switch and the arm goes up?

1 Like

We had to do this at school last year as well. I’m pretty sure it is when the bumper switch is pressed, the motor has to spin the gate 99 degrees

so basically it’s just building and coding involved, the build is just constructing a motorized gate with a potentiometer that will rotate at a 90° and we will set up the motor to make the push button sensors open and close the gate. i’ll show a picture of our build for a better idea.

sorry, it’s kind of a bad photo

1 Like

I would do something like this:

If the bumper is pressed

Then spin the motor 90 degrees

I don’t have my laptop at the moment either so I can’t show you what it would look like in blocks

i understand the concept of it, i just don’t understand how to code it or how to put it all together :frowning:

It looks to me like those are limit switches and you have one on the top and one on the bottom. If so, it might be something like this (it’s kind of different than the way we did it at my school)
16354656067844220640532180328495

those are limit switches but they decided to just change the build to using 2 bump switches and i wasn’t able to take a photo of it after that. do u think something like this would work?

task main ( )
{
while(1==1)
{
if (SensorValue[bump1]==1)
{
startMotor(port2, 63);
wait1Msec(300);
stopMotor(port2);
}
if (SensorValue[bump2]==1)
{
startMotor(port2, -61);
wait1Msec(300);
stopMotor(port2);
}
}

this is the best i can think of but it doesn’t seem right

That probably would work, but I would consider maybe changing it from milliseconds to degrees. It’s just my personal preference though.

You seem to be indicating that you are going to have 3 sensors on this arm that was built; 2 limit [or bumper] switches and a potentiometer. That seems to be missing the ‘outside activation’ factor (unless the arm is just supposed to indefinitely go up, pause, go down and then repeat?). Also, if you are telling it to start and stop when hitting the limit/bumper switch why would you also be using a pot to tell it how many degrees to go?

Since your information didn’t seem to match what I would have expected of a project like this, I looked up ‘toll booth challenge vex’ and found several videos demonstrating it. All of the videos I watched showed instead a set-up where there is a bumper switch on the outside that, when pressed, activates the arm. The arm then EITHER goes up until it hits the top limit switch, pauses for a set amount of time (or waits until you hit the bumper switch again, on another video), and then goes down until it hits the bottom limit switch and stops OR uses a potentiometer to go up 90 degrees, pauses (or waits for bumper switch to be hit again), and then goes down again.

What you’d need to code for limit switches would be:

  • When I hit the bumper switch, activate the motor to lift the arm up
  • When the arm hits the top limit switch, stop the motor and wait xx seconds (or wait until bumper switch is hit again), then activate the motor to drop the arm down
  • When the arm hits the bottom limit switch, stop the motor

Alternatively, you could use a bumper switch and a potentiometer and say:

  • When I hit the bumper switch, activate the motor to lift the arm up
  • When the pot hits 90 degrees, stop the motor and wait xx seconds (or wait until bumper switch is hit again), then activate the motor to drop the arm down
  • When the pot hits 0 degrees, stop the motor

So, I’d say the first thing you need to do is to decide exactly what you intend to happen and how you plan to make it happen. Only when you’ve done that can you really determine what code you will need.

1 Like

You can’t. The 393 motors don’t have built in encoders.

I didn’t see that. I thought they were V5