My students are creating an amusement park attraction for lego minifigs. It’s kind of a Guy’s Grocery Games style get up. They are trying to use two motors to swing the store doors open, allow the grocery cart (robot) to drive through, and then swing closed.
The motors will rotate correctly on the first command. However, after waiting 5 seconds, they will not change directions. Can someone please help me with this code? It’s probably something simple but we’re missing it.
Thanks,
Jennifer
VEX IQ (1st Gen)
(I attempted to post earlier, but should have read through it first - it was a bit jumbled.)
Thank you. Sorry for any delay in my response time; it takes a while for my posts to be approved (I haven’t posted before). I have my students this morning. I’ll get more information from them when I see them.
-Jennifer
You need to add a “(motor name) spin timeout (number) seconds” so that it will stop turning after however long you put in should it get stuck/try to rotate farther then it can. this is from vrc but I’m pretty sure that it is in IQ too though.
Thank you. We turned the velocity up to 20 and only one motor was active after that. A student suggested something might be wrong with our brains… We just changed the brain out and it’s running as intended. Thank you for your help - the velocity was definitely very low.
From what I can tell, you are stopping the motors right after they are told to spin. I am not 100% sure why opening works and not closing, however I would suggest clicking the right arrow to expand the spin for block so that it says wait until finished, This will most likely fix your issue. I second the velocity issue, I assume you are thinking this will be a rate out of 1, and are looking for 20%.
In my experience this has been what is causing the issue, however I am interested if this truly is the solution as the doors open. Please keep us posted and feel free to ping me if you have any questions or this does not work!
Signing off and Signing my Life away to a new robotics season.
-Blaziumm
The movement blocks default to wait for the command to complete. If you expand the block, it will say “and don’t wait”, and it will not wait for the command to complete before moving to the next block.
In this case, while it is unusual to have a stop command after the spin for blocks, it will not cause any issues. The spin for blocks will stop the motor(s) once the target position has been reached. So it would just tell the motors to stop again.