|
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.
|