Jump to content
The simFlight Network Forums

Is there a way to translate Pot reading to key press?

Recommended Posts

Hi there,

I've searched around and have not found any post that is related to this.

I'm building a GNS 530 and I'm using a rotary potentiometer with key to be used as power on/off and volume control. The software that runs the GNS 530 only interacts with hardware via key strokes. In this case all buttons and encoders I get them translated to key strokes, which is then sent to the GNS 530 software. 

However, since potentiometer readings can't be seen in the Buttons + Switches screen I wonder if there was a way or code it to look like an "encoder" in FSUIPC? 

I'm running the latest FSUIPC version.

Link to comment
Share on other sites

1 hour ago, Filipe Bessa said:

However, since potentiometer readings can't be seen in the Buttons + Switches screen I wonder if there was a way or code it to look like an "encoder" in FSUIPC? 

MOVED FROM FAQ SUBFORUM -- please alaways post support questions to the Support Forum, i.e. here, not to reference subsections!


Encoder's send button presses, effectively. If your pot is seen as an axis input in the Axis Assignments tab of FSUIPC, then you can do what you want in either of two ways:

1. Use the right-hand side of that assignments facility to assign up to 10 different actions depending on the value being seen.  For keystrokes you need to assign to one or other of the FSUIPC-added controls "Key press and release" or the similar separate Press and Release controls.

2. Assign the axis on the left-hand side of the same Tab to a Lua plug-in program you'd need to write. This would receive the Axis value as "ipcPARAM" and could test the value and send a keypress using the Lua ipc library facilities to do so. Bear in mind that with pots achieving the exact values every time is virtually impossible. You'd need to allow a range of values for each, just as with the first option.



Link to comment
Share on other sites

Hi Pete,

Thank you very much for the quick response.

The option two may be the option for me as the right-hand side only provides the mapped variables. In my case I need to transform it in key presses.

I understand I won't have accuracy with this approach, but making it to work somehow close to the real volume knob in the GNS 530 I'm happy with it. 

I'll dig into the documentation to look at the LUA plug-in. I had coded a few functions once using LINDA and FSX to communicate with LVARs from Carenado. At a first glance I assume I should send the axis reading to a custom "offset", which I can then read via the script and then translate to key strokes.

Thank you.

Filipe Bessa

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.