nebraska Posted July 29, 2012 Posted July 29, 2012 I'm using the PC to program the block. I'm assuming this is probably a simple program but I'm about 10 seconds from launching my laptop through the window. Here is what I'm trying to do. 1. At the press of the touch sensor I want the motor to turn unlimited. 2. At the release of the touch sensor I want the motor to stop. 3. At the press of the touch sensor I want the motor to turn unlimited the opposite way of step 1. 4. At the release of the touch sensor I want the motor to stop. 5. Back to step 1. I want to slam my head into the wall I'm so frustrated... Quote
Phoxtane Posted July 29, 2012 Posted July 29, 2012 Are you using the software that came with the Mindstorms kit? If so, I can help; I need to wait for this render to finish first, and then I'll see about making an example. Quote
Conchas Posted July 29, 2012 Posted July 29, 2012 By this time I guess you don't have your laptop anymore to read this answer... Anyways... You need a counter to increment each time the motor rotates. At each time you check where the counter modulus 2 is 1 or 0. Depending on the result you turn the motor in one direction or the other. Best! Quote
nebraska Posted July 29, 2012 Author Posted July 29, 2012 Are you using the software that came with the Mindstorms kit? If so, I can help; I need to wait for this render to finish first, and then I'll see about making an example. Yes I am using that software. I put the laptop away and switched to jack Daniels. Quote
Phoxtane Posted July 29, 2012 Posted July 29, 2012 Well, I think I've got a program for you that'll work: https://dl.dropbox.com/u/84375076/nebraskaTouch.rbt The robot will wait for the touch sensor to be pressed, at which point the motor will rotate forward until you release the sensor. The motor will then stop, and wait for the sensor to be pressed again. The motor will now rotate backwards until the sensor is released, where it will stop again. That's all in a loop, so you should be able to swap motor directions with ease. I found that adding a wait block with a small .05 second delay at strategic points solved an issue I encountered where the motor would rotate the same direction after I had cycled the sensor. I'm guessing that it was partially operator error where I wasn't removing my finger from the sensor fast enough, and the program would advance through the next section so fast the motor wouldn't respond. By the time the sensor had been cycled, it would have already been back to where it started. Five-hundredths of a second really makes a difference! What sort of project are you working on? I'm thinking of one of those arcade cranes that you move a claw around in and grab prizes... Quote
kieran Posted July 29, 2012 Posted July 29, 2012 What sort of project are you working on? I'm thinking of one of those arcade cranes that you move a claw around in and grab prizes... that would be fun.. Quote
nebraska Posted July 29, 2012 Author Posted July 29, 2012 (edited) Thank you very much. I will try this in a bit. Although the crane idea is a great idea; it's for an interactive mini fig scale German U-Boat. I needed your mindstorm solution for the dive planes and periscopes motors... EDIT ..just downloaded it and tried. It's exactly what I wanted. Thank you very much for your help! I shall sing songs of praise about Phoxtane today... Edited July 29, 2012 by nebraska Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.