djlidgley Posted April 30, 2009 Report Posted April 30, 2009 Hi Is it possible to program a button press on a joystick to send a virtual button (button 9) at offset H3340. I have tried sending to x3340 with parameter x9 but it does not seem to work. I am wanting to do this so I can detect the joystick button being pressed in a program of my own over a network with WideFS using VB.net and FSUIPCDotNetClient1.3, FSUIPC 3.81, Widefs (from log) version 6.763. My program can see virtual button 9 being pressed using the buttons in widefs over the network so that part seems to be working ok just having difficulty getting FSUIPC to send if. Hope you can help or point me in the right direction should I have missed something. Dave Lidge
Pete Dowson Posted April 30, 2009 Report Posted April 30, 2009 HiIs it possible to program a button press on a joystick to send a virtual button (button 9) at offset H3340. I have tried sending to x3340 with parameter x9 but it does not seem to work. Because the value "9" is binary 1001 which is TWO bits -- bit 0 and bit 3, so switching both those buttons on. Button 9 is bit 2^9, or value 512 -- if you write 2 bytes to 3340. Or you could view it as bit 1 (9-1) in the next byte (3341) and write 2^1 = 2 to 3341 instead. Bear in mind that this only switches the button ON. To switch it off you'd need to write 0 to that bit. Also bear in mind that by writing a byte you affect 8 buttons (8 bits in a byte), by writing a word you affect 16 buttons. You should really read the byte, OR this bit in (to switch on), or AND the bit out (to switch it off) then write it back. If you are programming a button via FSUIPC options then just assign it to Offset Byte Setbits with offset 3341 and parameter 2 to set the button ON, and Offset Byte Clearbits with the same offset and parameters to switch it OFF. If you want to toggle it on and off alternately with one button you could use Offset Byte Togglebits. Regards Pete
djlidgley Posted April 30, 2009 Author Report Posted April 30, 2009 many thanks Pete for the rapid response and solution. all makes sense. Will implement it first thing in the morning. Dave Lidge
djlidgley Posted May 1, 2009 Author Report Posted May 1, 2009 Hi Pete Everything works great now. Thanks for your help. Much appreciated. Dave
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now