Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

Featured Replies

Posted

Hi all,

I have a LEGO office building with an elevator. I've automated the elevator with a mindstorms touch sensor. The program starts by descending down the elevator shaft until it sits on top of the touch sensor at the bottom of the elevator shaft. Ideally, the touch sensor is supposed to trigger the mindstorms motor to turn in the opposite direction and pull the elevator back up for fifteen seconds. The mindstorms motor turns again in the opposite direction, so the elevator descends down again to hit the touch sensor. (The process repeats indefinitely) In a vacuum, this program works fine. However, I've had numerous issues with the sensor not triggering, and the elevator eventually winds in the wrong direction and binds with the roof, breaking. I've tried making the elevator heavier, but it still has issues.

 

I want to program a fail safe so that it will bypass the first wait block or cut off the program if the touch sensor doesn't trigger within a certain timeframe. I've included a picture of my current program. Within the infinite loop, I want the loop to start by waiting for the touch sensor to be pressed, then executing the two other motor commands I have following it. While the program is waiting for the touch sensor to be pressed, I want another thread to wait for twenty seconds. If the touch sensor is not pressed within that timeframe, I want the program to bypass the first touch sensor wait block and continue with the last two motor rotations (then repeat). I've been able to branch off into two different coding threads within one program, but I can't recombine the two inputs into the beginning of one block. How do I do this or accomplish my goal in another way? I'm at a convention right now and I really just want this to work. 

 

Some more information, the mindstorms motor is connected to a control switch, which tells my power functions motor which way to turn. That's why the mindstorms motor rotations are so short.

 

Thank you everyone for your help.

 

Edited by pjf1000

You could try to turn the motor for a given amount of rotations or you could use a light sensor (dark = elevator in front of it; light = elevator not in front).

Sorry for the late response, but I think I know how to code around that problem.

Try creating a loop (it could repeat indefinitely, but it really only needs to run once) and give it a unique name.

Then create a branch for each trigger within that loop, and at the end of each trigger interrupt said loop.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.
Sponsored Links