View Single Post
  #4   Spotlight this post!  
Unread 16-02-2011, 01:50
vhcook's Avatar
vhcook vhcook is offline
Reader of Things
AKA: Victoria
FRC #1939 (Kuh-nig-its)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas City, MO
Posts: 546
vhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond repute
Re: need help rookie

Here's what I see...

- You are opening an analog port inside the while loop, which is not generally a good idea as it's going to try to open it again every time the loop goes around.

- If your boolean is False, you are setting the motor output to 0, which is a stop.

- If the boolean is true and the voltage on the analog port is greater than 5, you are setting the motor to go forward (probably, depending on how it's wired and physically mounted) at half speed.

- If the boolean is true and the voltage on the analog port is less than 5, you are setting the motor output to 0, which is stop.

Here is some useful information for looking at this problem:

- Analog ports supply a 5V source, so I would generally expect the signal to be less than 5V all the time.

- Motor speeds have a range of -1 to 1, with 0 being stop.

Here is what I would change:
- Move the AI Open outside the while loop

- I'm not quite sure what the analog input is measuring, but you're going to want to change your logic a little so that cases that are likely to happen have a non-zero speed.

I hope this helps. If not, please some more questions and I'll try again.
__________________


Reply With Quote