# Motor moving by degree amounts with a button

Hey,

Just a quick question regarding joystick buttons:

How would I make a joystick button so that when it is pressed once it moves a motor in a degree amount (e.g. 45*), then stops?

[ignore if you don’t care about why]
We have a door that holds the basketballs from getting into the shooter, (which when the door moves (in a 360* fashion if that makes sense) it lets one ball through) and moving it in increments would be so much easier.
[/ignore]

I can make a motor that is controlled by a trigger where the motor stops when you release it, so I have some exposure to buttons but yeah.

Thanks guys,
Tony

p.s. I’ve done my research and I haven’t really found anything that works.

You’ll need some sort of sensor to give you feedback on the position of your door. Use that feedback to stop the motor when it has moved far enough.

In past years, our team has used a potentiometer for such a task. Have it connected in some way to the shaft of whatever it is you are having your motor turn, then read the voltage output in your code (analogue input). Take a few voltage readings at different degrees, then plot those points in a scatter plot in excel (x values would be the voltages, y values would be the degrees (you can choose what angle is 0 of course). Fit a trend-line to the data, and just incorporate the line’s equation into your code. Easy conversion of pot voltage into degrees. There are other sensors that do a similar same thing, such as the encoder. Good luck!

Note: What I described only gives you the current “degree” of the object being rotated. You would need to determine how to take that data and make the motor turn (which way, what speed, for how long, etc)

This is exactly what I’m trying to accomplish as well. I’ve found an example from Team 358’s website. I’m going to try it tonight but with a use of a button so ill let you know how it goes.

Thanks for the help guys!

Now that I’ve thought about it, degree amounts can be measured in time. How would I go about controlling a motor (in seconds) with a button?

Sorry for the triple post, but I think I may have found what I needed. All I can’t figure out is where to find the green arrow in the tan box with the green circle underneath as shown in the picture below.

Search the LabVIEW help for “feedback node”.

Oh that. I tried using that and all the connections would break when I tried to wire it. I’ll keep playing with it, thanks though