PDA

View Full Version : does anybody know how to program a potentimeter (<--spelling mistake)

chrisw
01-24-2002, 03:40 PM
does any body know how to program the thing that allows only 90 degree turns using PBasic?

Joe Johnson
01-24-2002, 05:28 PM
Many people know many things. We can only explain them to you if you formulate your question carefully ;-)

Seriously though, define your problem and desired result carefully and I am sure you will get a lot of help.

Joe J.

srawls
01-24-2002, 09:41 PM
Yes! I know how to program potentiometers all too well :) We had four of them on our robot last year, with pre-defined postions involving all four of them. I had many bugs in that code ... but it sure was fun getting it to work since that was the first time I'd ever used pbasic before.

Now, to your question. Are you talking about the torque motor? I know that doesn't allow full rotation, so is that "the thing that allows only 90 degree turns." Or do you want to use a pot and limit something to only 90 degree turns? Like Mr. Johnson said, please clarify your question and we'll all be glad to help.

Stephen

chrisw
01-25-2002, 02:34 PM
i'm trying to use a pot to limit a motor to turning only 90 drgrees. I need to know what the value that is stored in the sensor variable represents and how to prevent the motor from turning ( the motor will likely be run through a victor). also, is their a way that i can have the program slow down the motor as it approaches the end of a 90 degree turn?

srawls
01-25-2002, 08:29 PM
Well, just connect the pot to the motor, and the value you get is the position of the motor. Calibrate the pot however you want, but you need to find the values of the limits (the two position values that define the 90 degree turn). Then just put an abstraction in where the button (or joystick) no longer tells the motor to go a certain speed, but it tells it to go to a certain position, then have an equation to figure out how fast to move the motor taking into account the current position and the position the button (or joystick) wants the motor to move. Then all you have to do is max and min the 'position' to the limits found earlier.

I hope that made sense, if not than it's just the ramblings of a 16 year old programmer who still has flashbacks of late nights trying to fix the robot code :)

Stephen