Jump to content
The simFlight Network Forums

Does FSUIPC interface with an Arduino module?


Recommended Posts

I've got an Arduino that interfaces with several hardware modules - e.g. MCP interfacing with buttons, lights etc.

Does the FSUIPC GUI interface with such modules - free or paid version?

If it's via the serial port - I assume there's a protocol and I've got to implement the protocol on the Arduino.

i.e. listen for commands from FSUIPC - turn on an LED or send commands to FSUIPC - user rotated a knob.

If the GUI doesn't - then I guess I have to write a client module that interfaces with both FSUIPC dll and

my arduino via the serial port.

Any help appreciated?

 

 

 

 

 

Link to comment
Share on other sites

2 hours ago, erjdriver said:

I've got an Arduino that interfaces with several hardware modules - e.g. MCP interfacing with buttons, lights etc.

Does the FSUIPC GUI interface with such modules - free or paid version?

If it's via the serial port - I assume there's a protocol and I've got to implement the protocol on the Arduino.

i.e. listen for commands from FSUIPC - turn on an LED or send commands to FSUIPC - user rotated a knob.

If the GUI doesn't - then I guess I have to write a client module that interfaces with both FSUIPC dll and

my arduino via the serial port.

FSUIPC doesn't embody hardware drivers at all. It supports standard Joysticks, and does use the GoFlight driver for GoFlight device (inputs only). For things like Arduino I use simply lua plug-ins. the Lua library does support COM devices well, and it is easy to knock up short programs to send and receive messages to/from an Arduino and simulataneously deal with Sim variables, inputs and outputs.

Check the Lua library document and the examples supplied in the ZIP.

Pete

 

 

Link to comment
Share on other sites

9 hours ago, erjdriver said:

Is this the latest info?

The latest documents should already be included in your FSUIPC installation. For FSUIPC4 & 5, this will be in your FSUIPC Documents folder, under your Modules folder. For FSUIPC6, you need to select the documentation during installation, and it is installed in a folder called FSUIPC6 under you windows Documents folder.

10 hours ago, erjdriver said:

I can download LUA for Windows...then...

You don't need this. FSUIPC has its own lua interpreter.

10 hours ago, erjdriver said:

Is there a document explaining where to go from there?

There are various documents included with FSUIPC on the lua interface provided. However, for an introduction to lua or its standard libraries, please google.

Link to comment
Share on other sites

I've installed FSUIPC6 to P3D...and looking at the LUA document pdf files.

 

It says add .lua files to the Modules folder - where is this folder?

Can you suggest a test lua file from the examples folder that will display something on the sim screen - for me to know it's working

Would mydisplay.lua work??

 

Do I need to restart P3D on each edit or will it be automatically be re-loaded on edit/save.

i.e. is this Modules folder being monitored by fsuipc for auto reload.

Thanks.

 

Link to comment
Share on other sites

6 hours ago, erjdriver said:

It says add .lua files to the Modules folder - where is this folder?

Where the documentation uses the term 'Modules folder', it refers to your FSUIPC installation folder. Previous to FSUIPC version 6, FSUIPC was, by default, installed in a folder called Modules, located under the main P3D folder. So its the folder that you select to install FSUIPC6 into. if you don't know where this is, there is also an 'Open Folder' button in the FSUIPC6 logging tab that will open Windows Explorer on this folder.

6 hours ago, erjdriver said:

Can you suggest a test lua file from the examples folder that will display something on the sim screen - for me to know it's working

Would mydisplay.lua work??

Sure.

6 hours ago, erjdriver said:

Do I need to restart P3D on each edit or will it be automatically be re-loaded on edit/save.

No, you need to restart the lua. i.e. kill it (if its running) and start it again. The file will be re-compiled each time it is ran.

6 hours ago, erjdriver said:

i.e. is this Modules folder being monitored by fsuipc for auto reload.

No, it isn't But as I said, you just need to stop the lua running and then restart it.

Link to comment
Share on other sites

Ok - looks like that folder is

C:\Users\mini\Documents\Prepar3D v4 Add-ons\FSUIPC6

I dropped MyDisplay.lua in that folder and restarted p3d - I don't see any changes or references to lua in the menu.

Do I need the paid version of fsuipc?

I've read the FSUIPC Lua Plug-Ins pdf file - but no help.

 

s

 

Link to comment
Share on other sites

I'm not doing anything besides dropping that lua file in the folder.

Since then I read on internet that I need to assign to a keyboard.

i went to button&switches and tried to assign a key and i wasn't able to find the lua file to map to.

i'd also like the file to be run automatically.

is all this startup info in the pdf file - because I went thru it at least 2x.

 

Link to comment
Share on other sites

some progress...

i see there's a log file for both lua files.

my test.lua is

h = display.create("Jason Fayre Display", 8, 800, 400)

   
display.show(h, 8, "hello")

 

in the test.txt file - i've got the following error message.

`** LUA Error: ...\Documents\Prepar3D v4 Add-ons\FSUIPC6\test.lua:2: attempt to index global 'display' (a nil value)`

 

Link to comment
Share on other sites

9 hours ago, erjdriver said:

my test.lua is

h = display.create("Jason Fayre Display", 8, 800, 400)

   
display.show(h, 8, "hello")

 

in the test.txt file - i've got the following error message.

`** LUA Error: ...\Documents\Prepar3D v4 Add-ons\FSUIPC6\test.lua:2: attempt to index global 'display' (a nil value)`

 

What version of WideClient are you using?  It must be very old if the Display library is not included. It was added in version 6.895 (as shown on page 41 of the Lua library PDF). Of course, the display library doesn't exist in FSUIPC -- you aren't trying to use it there, are you?

Pete

 

Link to comment
Share on other sites

My goal is to communicate with my arduino and i think you suggested lua.

i downloaded fsuipc 6.0.10 and installed it - and registered.

copied the test LUA files to the add-ons folder and am just trying to get lua up and running.

getting above error.

the lua snippet above is the entire lua file and it's in [Auto] of the fsuipc.ini file and yes i guess it's being run when the scenario for the plane is loaded.

 

ok now i need wideFS you say - i installed it, ran wideclient and then when p3d runs - it says  another p3d program is already running.

version 7.159.

 

 

 

 

 

 

Link to comment
Share on other sites

15 minutes ago, erjdriver said:

ok now i need wideFS you say - i installed it, ran wideclient and then when p3d runs - it says  another p3d program is already running.

You run WideFS on a client PC. If you want to run it on the same PC as FSUIPC/P3D, you have to change the class name - see the provided documentation for details.

But, do you really need WideFS?  This is really only needed to run FSUIPC clients on a different machine to P3D o/FSUIPC. You should not use that just to use the lua display library. You can use ipc.display instead for luas running in FSUIPC. For example, try the attached lua:

FPS_Monitor.lua

Link to comment
Share on other sites

Hallejulah - finally getting somewhere.

I appreciate your help very much - but really some simple docs for the total noob would save them and yourself quite a bit of time.

maybe even add the above ipc.display lua file in the example folder renamed like - test.lua or first.lua or something similar.

 

ok - now i can proceed towards learning lua and serial i/o.

i understand fsuipc is using it's own lua processor and api - where should i look besides the 2 pdf files in the docs.

Thanks again.

 

Link to comment
Share on other sites

1 hour ago, erjdriver said:

My goal is to communicate with my arduino and i think you suggested lua.

i downloaded fsuipc 6.0.10 and installed it - and registered.

copied the test LUA files to the add-ons folder and am just trying to get lua up and running.

getting above error.

the lua snippet above is the entire lua file and it's in [Auto] of the fsuipc.ini file and yes i guess it's being run when the scenario for the plane is loaded.

But WHY are you using the "display" library, which isn't needed and which isd notihng at all to do with using COM to talk to your Arduino?

58 minutes ago, erjdriver said:

I appreciate your help very much - but really some simple docs for the total noob would save them and yourself quite a bit of time.

maybe even add the above ipc.display lua file in the example folder renamed like - test.lua or first.lua or something similar.

Why? what are you trying to test?

59 minutes ago, erjdriver said:

i understand fsuipc is using it's own lua processor and api

The lua API is the standard Lua language as at version 5.  The lua compiler / interpreter is public domain and can be incorporated into any program. The language isn't changed. FSUIPC just adds many useful functions in additional libraries. Thjose are all related to thing you might want to do specifically in a flight Sim situation.

1 hour ago, erjdriver said:

where should i look besides the 2 pdf files in the docs.

The PDF files we provide only document the FSUIPC (and WideClient) implementation of Lua and the extra libraries we implement. Whilst you can learn by looking at all the Lua examples we provide, the prime resource for the Lua language is Lua.org as highlighted in the main installed Lua PDF document. If you want to learn the language itself, that is the place to go. You can also buy books on the subject.

Pete

 

Link to comment
Share on other sites

18 hours ago, erjdriver said:

for this particular FPS_monitor.lua file - it seems to be just close the window.

Sorry, i don't get the point of this sentence. What are you saying?

FPS or VAS monitor plug-ins only exist to display values, so, yes, they have a display window. But most plug-ins just do stuff in the background. A display isn't needed or welcome for many uses for plug-ins.

18 hours ago, erjdriver said:

What if the lua file has no window?

If it doesn't need to display anything why should it have a window? I don't understand what you are getting at, sorry.

Pete

 

Link to comment
Share on other sites

Sorry if I wasn't clear.

Yes most probably my lua code will be without a window.

My question is - when I edit the lua file - how can I force a reload.

"Or to just kill it" - how do I do that without reloading P3D.

"you can also use the provided control" - where is this control?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.