Welcome to Cockpitbuilders.com. Please login or sign up.

May 06, 2021, 10:42:40 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
35 Guests, 0 Users
Members
  • Total Members: 4032
  • Latest: vasekg
Stats
  • Total Posts: 57008
  • Total Topics: 7592
  • Online Today: 23
  • Online Ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 0
Guests: 35
Total: 35

COUNTDOWN TO WF2021


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

Need some LUA help.....

Started by RayS, February 17, 2021, 09:24:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RayS

I'm trying to to get X-Plane FlyWithLUA to connect to an Arduino Mega256.

I have 1 line of code: (After stripping away everything else that isn't failing)

dev = com.open("COM4", 9600, 0)

This code fails with:

lua:1: attempt to index global 'com' (a nil value)

What the heck am I missing?

The error appears to point to a missing DLL or something... I've spent the past couple evenings trying to figure this out and all I've done is bump Heineken Beer stock up a few points.


Ray Sotkiewicz

ame


navymustang

Have you verified that "COM4" is the exact spelling of the com port the Arduino is connected to. The error is actually telling you that "COM4" is pointing to a nil value.

http://thegeekforge.com/2017/11/10/arduino-lua-fsuipc-tutorial-001_a/

OK - this is for FSX or P3D, but I imagine the same code structure works for both.
My 737-800 full-scale cockpit is complete and been put in storage (for sale). Now onto my full-size helicopter project. An AOPA member and LifeTime member of National Association of Flight Instructors. Please note that I am a self-employed professional cockpit builder that provides consulting to defense contractors and civilian schools and airlines.

RayS

I had to post on X-Plane.org for this.

com.open() should work but "com" isn't recognized, nor is "ipc"

I swear I'm missing something stupid-simple...

Ray Sotkiewicz

navymustang

The only thing I can think of is that you are missing the COM library with your Lua installation.
My 737-800 full-scale cockpit is complete and been put in storage (for sale). Now onto my full-size helicopter project. An AOPA member and LifeTime member of National Association of Flight Instructors. Please note that I am a self-employed professional cockpit builder that provides consulting to defense contractors and civilian schools and airlines.

Fess_ter_Geek

February 19, 2021, 08:14:36 AM #5 Last Edit: February 19, 2021, 02:44:19 PM by Fess_ter_Geek
That Geekforge lua code will not work with X-Plane it is for FSUIPC only. Pete included a COM library in FSUIPC with it.

When I first tried to get my radio working with X-Plane, I could not figure out how to get the lua com library installed and or working.

I bailed on FlywithLua, dabbled with C#, and settled with the Python Plugin.
I got the radio working nearly as good as with P3D but acceleration on HDG bug and CRS knob varies from plane to plane. Some airplane devs use their own datarefs which can nul some functionality...until you code it in. Just like in P3D, with devs using custom Lvars, one size does not fit all...without a table, anyway.

The nice thing about the Python plug in is that you can have multiple py scripts running just like LUA in FSUIPC.

If you go with Python Plugin, ye best be knowin how to indent propper like, lest ye be stuck in the damnation of the error log.

~Fess

RayS

Thanks, Fess_Ter_Geek!

I was slowly coming to that realization last night that maybe this just won't work in X-Pain.

I'll try the Python plugin. Interestingly, I am learning Python since I need that skill in a new role at work.

Thanks again for the info. Now I can stop bashing my head against the wall.
Ray Sotkiewicz

ame


Trevor Hale

I HATE SNAKES..........   J/K
Trevor Hale

Owner
http://www.cockpitbuilders.com

Director of Operations
Worldflight Team USA
http://www.worldflightusa.com

VATSIM:

ame

Quote from: Trevor Hale on February 19, 2021, 01:57:51 PMI HATE SNAKES..........   J/K
My on-again/off-again Python X-Plane library is called SOAP (Snakes on a Plane). It is humourous on so many levels (not least that it isn't finished).

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate