View Single Post
  #8   Spotlight this post!  
Unread 14-08-2006, 17:35
CircularLogic CircularLogic is offline
Registered User
FRC #1546 (Chaos Inc)
Team Role: Leadership
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baldwin
Posts: 38
CircularLogic will become famous soon enoughCircularLogic will become famous soon enough
Re: Help needed with coding simultaneous movement (EasyC/VEX)

Quote:
Originally Posted by intellec7
I have attached code that *should* work. You will probably need to modify all of the Rx inputs and PWM outputs.
If any one sees a problem with this code, you are probably right . :-D
BTW there is no overflow protection, which might happen, but I am assuming you don't need really precise servo control? When you stop moving the robot the servo stops in place, but when you start moving it again, the servo moves to its positive limit and then starts the back and forth movement again.

Yea, there appear to be some syntactical (things written wrong) and symantical (things done wrong). The simplest thing is that the incrementing and decrementing (is that a word?) of pendu_speed dont really do what they are supposed to. Instead incrementing or decreasing you assign the value of 1 or -1 to pendu_speed. It should be pendu_speed++ or pendu_speed--.

The next problem is with this statement

pendu_servo = pendu_speed + pendu_servo

the value of pendu_servo could be 250 in one loop and the next time around, the joystick could be nuetral but because pendu_servo already has the value of 250, it will continue to be 250.


You could probably fix that by moving the code block setPwm(3, pendu_servo) into the else statement. Then change the if statement to to setPwm(3,127). That way the if the statement evaluates to true (meaning joystick is nuetral), the pwm will be dead. However, if it evaluates falsely, it will be assigned to a value.




And in terms of the actual servo movement, I cant really help because I have actually never worked with servos.



And my *corrections* of your mistakes could also be mistakes.
__________________
Team 1546 Chaos Incorporated
2005- SBPLI Rookie All Stars
2006- SBPLI Sportsmanship award.

Gotta hand it to the straight line autonomous mode, the most effective defense out there.

Proud beyond belief of the accomplishments of the second year, 20th ranked, 6 wins and 6 losses Chaos Incorporated.