Using a USB joystick with MicroBasic

4 months 5 days ago - 4 months 5 days ago #29534924 by bartemat
Howdy,

I have 4 MDC2460 controllers that are connected in a CAN bus to control a robot. The master node has a laptop with Roborun plugged into it and the laptop has a USB joystick plugged in. I have several questions:

1) Is it possible to apply a deadband to a USB joystick? I am using getvalue(_CIS, 1) to access the joystick value that is applied to the motor and then I am applying that value to the other motors over CAN. However, Roborun utility applies that value before my Microbasic script does anything. Is there a better way to read the joystick value?
2) Is it possible to read the button presses on my joystick in Microbasic. The Roborun joystick utility recognizes them, but I don't know how to access those values in the script.
3) What does "Button out to C" do in the joystick configuration in Roborun?

Thanks for your time! I have poured over the documentation but I seem to be stuck. I have also attached the script that I have written.
Attachments:

Please Log in or Create an account to join the conversation.

3 weeks 5 days ago - 1 day 8 hours ago #29534980 by IsakVisini
Hi...I have not coded in C before but found it a good excercise to cross reference both languages and come to a solution. The funny thing is I got the C code working first and then had some trouble with syntax on the button inputs. What the main problem was is that I had messed around with the
descriptors and I had also neglected to carefully check how I was setting up interrupts. Once again, small things tend to get overlooked when you are too close to the drawing board.

pcb manufacturer

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds