|
Sorry: this was meant to go into the Atom board, not atomPro. Hello: I am trying to use HPWM and seeing an odd behavior. If I manually set the duty to my maximum period of 12800 then my motor runs fine, if I have code that changes it however then the motor stops running when it gets close to the maximum duty cycle. I am using a lynxmotion PS2 controller and trying to get variable speed from the joystick. I have a fixed motor period of 12,800 set in code The following code works fine. ----------------- FORWARDFULL HIGH P9 HIGH P10 HIGH P11 HIGH P8 HPWM LEFTWHEEL,LEFTMOTORPERIOD,12800 serout 1,i9600,[1,1,dec leftmotorduty] RETURN yet the next code segment stops the motor when it gets close to the 12,800 value. It seems to stop around 11,400 but is random so I cannot say an exact figure. I can watch the serial output, I so know the value is not ever going over 12,800 in fact I also used some code to set it at a maximum of 12,800 after the joystick values are added and it still quits the motor. The motor is nicely variable up to around the 11,400 value. Wyy don't I just set it to stop at 11,400? because I tried that, and now it stops running at around 10,000 ! I cant understand this. Also it would be nice to know I am getting full motor speeds.
FORWARD: ' Goes forward HIGH P9 HIGH P10 HIGH P11 HIGH P8 left_joy_y = 128 - left_joy_y leftmotorduty = (left_joy_y * 100) HPWM LEFTWHEEL,LEFTMOTORPERIOD,LEFTMOTORDUTY serout 1,i9600,[1,1,dec leftmotorduty] 'HPWM RIGHTWHEEL,RIGHTMOTORPERIOD,RIGHTMOTORDUTY return
FInally I tried the wait command tp prevent any glitches and it throws a compiler error. HPWM LEFTWHEEL,LEFTMOTORPERIOD,LEFTMOTORDUTY, 1 I am on the latest 2.0.0.15 compiler. 1 last question. what is a good value to be using for motor period, I dont want to much noise getting back into my electronics. Thank you for any advice. -Stampee
|