Jump to content
The simFlight Network Forums

Paja

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Paja

  • Rank
    Member

Contact Methods

  • Website URL
    http://www.dc-9.eu
  • ICQ
    224401042
  • Skype
    brodha88

Profile Information

  • Gender
    Male
  • Location
    Czech Republic
  • Interests
    Gliding, sim building, VATSIM :-)

Recent Profile Visitors

469 profile views
  1. I know about using the other computer to slave, standard thing. I was just thinking about using the lowcost Linux boards - but if it is not possible, ok - thanks for info. I will try Lua to send the data, thanks :) Pavel
  2. Hello Pete, have you considered developing the WideClient for Linux? It would be very useful together with all those ultra cheap minimalistic Linux computers (Raspbery Pi, Arduino Yun, etc). They are small devices that can run simplistic version of Linux, so if we had WideClient on them, we could hopefuly access FSUIPC variables remotely via LAN - it would be easier than having ton of USB or RS232 devices connected to the flightsim computer with lot of their custom applications running... Pavel
  3. I have never been completely sure about which of those "DBl, FLT, DD, SB, SD, etc) types should I read so I have done this small LUA file which will help you to decide. You just need to change the offset ID on the second line and then simply run this LUA in your FSX - you will see your offset being read as all the available types and you can decide which of them fits your individual needs. while 1 do offset = "132C" --write the Offset ID from FSUIUPC4 Offsets Status.pdf (eg. "132C") test1 = ipc.readDBL(offset) test2 = ipc.readFLT(offset) test3 = ipc.readDD(offset) test4 = ipc.readSB(offset) test5 = ipc.readSD(offset) --test6 = ipc.readSTR(offset, 4) -- Not used test8 = ipc.readUB(offset) test9 = ipc.readUD(offset) test10 = ipc.readUW(offset) ipc.display("testDBL="..test1.."\ testFLT="..test2.."\ testDD="..test3.."\ testSB="..test4.."\ testSD="..test5.."\ testSW="..test7.."\ testUB="..test8.."\ testUD="..test9.."\ testUW="..test10) ipc.sleep(50) end Attached you can see the result for testing NAV/GPS switch offset reading. I need 1 or 0 regaring the switch position so I will use probably the UB type which is the "simplest" format of the offset which yet matches my need to be 0 or 1 - however all those except DBL, FLT and DD give the same result so technically this is completely up to me which of the remainings I will use. Pavel Brodsky
  4. Paja

    LUA COM library

    Ok, got it working... Attached I am sending the easiest ever example of serial communication with arduino. Just paste the INO into your arduino and the LUA into your FSX/Modules and you will get parking brake LED working on the Arduino's onboard LED. dev = com.open("COM3", 9600, 0) function pkgbrake(offset, value) if value == 0 then com.write(dev, "g") else com.write(dev, "a") end end event.offset(0x0BC8, "UB", "pkgbrake") int strValue = 0; int light1 = 0; const int out1 = 13; void setup() { Serial.begin(9600); pinMode(out1, OUTPUT); } void loop() { if(Serial.available() > 0) { strValue = Serial.read(); } if (strValue == 'a') { digitalWrite(out1,HIGH); strValue = 'z'; } if (strValue == 'g') { digitalWrite(out1,LOW); strValue = 'z'; } } Hope that helps. Pavel
  5. Paja

    LUA COM library

    Hello, thank you very much for you effort, I will try it as soon as I get to my Arduino which is currently at home... Very appreciated! By the way, I found this project: https://code.google.com/p/arduino-fs/which seems to be doing it similar way, I will try investigating it a little bit... Regards, Pavel
  6. Paja

    LUA COM library

    Interesting - I have tried real time printing of the n variable to a ipc.display and it returns just 1, regardless if the line is "a" or "g" or if I specify the length parameter or not. I have googled it but the ONLY thing I could find is some VRInsignt MCP driver where autor uses the same name for handle name and for variable which openes the com.open and he does NOT save it to any variable like dev=com.write but he uses just com.write... I have tried it exactly as he did and the result was quite...weird :grin: Do you have any tips where to get more info about com.write in LUA? I cant find it on their website... I have tried lot of COM sniffing programs but all of them are unable to open the COM port while FSX (or Arduino terminal or whichever app) is communicating on that port with Arduino... My only and last hope is to find another computer with COM port, try to wire them together and log on the second computer what is my LUA actually sending to it (LUA wont know it is not arduino but computer, I hope) Pavel
  7. Paja

    LUA COM library

    That sounds like a good point however code handle = com.open("COM3",9600,0) --COM 3 opened, 9600bps, no handshake while 1 do com.write(handle,"a",1) ipc.sleep(500) com.write(handle,"g",1) ipc.display("overhead driver ok") end gives the same result - just RX led blinking (even if I tried it with spaces inside like (handle, "g" 1). I found out that Arduino in default settings has 8-N-1 mode (http://en.wikipedia.org/wiki/8-N-1) - is it the same for LUA? I can change this setting to any other mode in Arduino if required... Or maybe am I missing something when LUA Library pdf says that I should use n = com.write( ? What should I in my simple example place instead of n? Pavel
  8. Paja

    LUA COM library

    Well if I start the portmon.exe it says Not Connected even if I start it after or before the FSX with transmitting LUA plugin (or any other COM software like the COM terminal from Arduino) - have you experienced it? Or possibly could LUA debug to some file everything it has sent via COM? The arduino is receiving data correctly, it blinks every 500ms with RX LED but the orders dont work so LUA must be sending something else than just a and g there :sad: When I send a and g by COM terminal it works with my board... What does the "handle" word mean? Does my code send "handle a" or "a"? Pavel
  9. Paja

    LUA COM library

    Didn't know, thank you for info ;) Pavel
  10. Paja

    LUA COM library

    Ok, I did some testing with updated code: handle = com.open("COM3",9600,0) --COM 3 opened, 9600bps, no handshake while 1 do com.write(handle, "a") ipc.sleep(500) com.write(handle, "g") ipc.display("overhead driver ok") end which does something... the message appears, the script runs, the Receiving LED on Arduino blinks quickly, but the arduino is not receiving what it is expecting to (the "a" should turn on a LED, the "g" should switch the LED off - which works from any Serial terminal app, so the arduino code is correct). Is here any way how to log the outcoming traffic from LUA? Pavel
  11. Paja

    LUA COM library

    Hi Mickey, thank you for the link. However as I understand from it he was working with HIDs, not with "pure" COM port which I am trying to... Pavel
  12. Paja

    LUA COM library

    By the way is it a good idea to use both sending and receiving from COM port in a single LUA file?
  13. Dear Pete, I am experimenting with direct communication between LUA and Arduino. If I suceed I would like to publish my results to give a cheap inputs/outputs to anybody who thinks that all those overpriced Opencockpits (and simillar) cards are just useless... I have my arduino programmed but I need some examples in LUA. Could you give me just a simple script which will be sending string "abc" always when it will be running? I mean - is my code acceptable? handle = com.open(3,9600,0) //COM 3 opened, 9600bps, no handshake com.write(handle, "abc") What does the word "handle" mean here? Is it variable name that can be changed, or what? The same for sending: handle = com.open(3,9600,0) //COM 3 opened, 9600bps, no handshake n = com.test(handle) my_received_data = com.read(handle,n) Is this way correct? I need just listen to COM port and when some string arrives from my arduino I need to store it into a variable... Thank you, Pavel
  14. I wish I knew the number of times I got stuck with lua because of forgetting to use "" for strings. Thank you, solved! Pavel
×

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.