Controlling two HB25 Motor Controllers with the Lynxmotion PS2 Controler
Newbie needs some help. I'm trying to create a Spin program that allows me to control two HB25 Motor Controllers using the Lynxmotion PS2 wireless controller.·Using the PS2 objects·off of the exchange I was able to·"map" the·two joysticks to get the full·motion range, 0-255.·I then created a simple formula to convert the output to a·pulse variable to send to the HB25.·The HB25 object used·generates a pulse range from 900 to 2090, also from the exchange. Now I'm trying to get those variables to the HB25; the intent is for individual motor control. I've included the program. When I download it no errors are generated, but I don't have any response from the HB25's. I've tested them using the HB25 object that is part of the enclosed code to verify they work.
Any guidance would be most helpful.
Thank you
Brian
Any guidance would be most helpful.
Thank you
Brian
Comments
HBLeft := ((fmath.FMUL(PS2.get_LeftY, 4.6875)) + 900) <# 2090
HBRight := ((fmath.FMUL(PS2.get_RightY, 4.6875)) + 900) <# 2090
Fmul requires two floats and I would bet that PS2.get_LeftY returns and integer. You then add the float from fmath to the integer 900
HBLeft := (fmath.FTrunc(fmath.FMul(fmath.FFloat(PS2.get_LeftY),4.6875)) + 900) <# 2090 or somithing like this should work
John Abshier
Thanks for the reply, unfortunately that didn't solve the problem. I seem to stuck trying to get the variable reated from the get.LeftY or get.RightY to the PUB that "drives" the controller. Somehow I'm not getting the resultant to the "Motor" method correctly.
I've tried a variety of approaches, with no success.
THanks again
John Abshier