3

My FLL team just got a couple of EV3 sets and the kids were trying to program a simple switch that has the robot drive into a wall, back up, and turn right once the touch sensor in the front is pressed.

The pressed condition in the switch has a move tank going backwards followed by a turn. The unpressed condition has a move tank going forward.

The robot just goes forward and does not stop after it runs into the wall and the sensor is clearly pressed.

We tried switching the bricks, the sensors, the cables, the ports and reinstalling the firmware. Nothing works. Help...

Thank you for the replies. I'm not sure I'm responding in the right spot but here is the screenshot:

simple_touchsensor_switch

Also, it's not a port number issue. In fact, when you check the ports on the software it shows that it's recognizing the sensor and its state on the correct port. And it does get pressed. We even tried pressing it manually just to make sure.

I just reinstalled all the software and firmware and now it's not even going through the switch! It just skips it and goes on to the last block. I think I'm out of my depth here...

2
  • Please provide a screenshot of the EV3 program. I suspect the sensor port number is the problem. The EV3 does some work in the background to get this to work automagically.
    – dfrevert
    Jul 18, 2014 at 20:26
  • Is the EV3 like the NXT where the sensor part for the program consists of 3 blocks motors on, wait until, motors off (used to be motors unlimited, wait until, stop)? Without the stop block I have never managed to get sensors to work.
    – user4104
    Oct 23, 2014 at 9:01

2 Answers 2

1

Are you sure that the button is being completely pressed? A quick test would be to hold the robot and manually press the touch sensor. If the wheels start turning backwards, then there isn't anything wrong, you just need to make sure the button gets pressed completely.

If you're sure the button is being pressed, then it's probably a software problem. It seems like you have a conditional block, is it reading the same port that the sensor is connected to.

You could make a really simple program that has a forward tank movement inside a loop and make the exit condition for the loop be to exit when the button is pressed. If you put an end block after the loop, the robot will drive forward forever until the button is pressed.

Hopefully one of those options will help you fix the problem!

1

Code is works as the robot is behaving. The problem is that the first block is a sensor block, which is processed in the blink of an eye. The second block moves forward for 2 rotations at 50% power.

So long as only one sensor is being watched, a wait for block is sufficient. Here is an example: enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.