READ UPDATE Control Location of where the arm is??
Ok So me and my team(We take part in BEST) are working on some possible designs for next years competition.
What we would like to do is be able hit a button and the arm on a robot go to a predetermined location.
As you know with BEST we are not given potentiometers or shaft encoders so we cant use those.
We were thinking about attaching a '+' shaped piece to the smaller of the 2 gears that we will use to move the arm (where the 2 line of the '+' cross would be the center of the gear)
We would use this '+' to hit a Limit switch every time a spoke came around to it.
I want to have some code to be able to tell where the arm is at.
What I was thinking is to having if statements that said something like
if the switch is pushed (resulting in a 1) and the motor value is positive then add 1 to the variable 'position'
if the switch is pushed and the motor value is negative then subtract 1 from the variable 'position'
that way I can use the variable 'position' later on in the code to tell it where to go.
so can some one help me out with the code for the if statements???
also if this is not a good way to try to do this could you provide an alternate solution to this problem
In the end we want to be able to make our arm go to 4 different positions no mater where its current location (1of the 4 locations) by the push of a buttonUPDATE
OK MagiCode: Your code works great! Thanks You for it!
we werent reall able to get "RobotDesigners" code to work. also we would really like to only use one limit switch
we have however come up with a gear system so that we can have about 64 points instead of the 4 that I first mentioned.
I have come up with some code (it may not be correct at all but it seems like something that could work)
heres the code i came up with to try to make it work with one limit switch.
hopefully you can understand it.