Jump to content
The simFlight Network Forums

bismond

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by bismond

  1. I'm a beginner amatuer programmer and I was wondering how to go about writing a program that would constantly scan a group of offsets while FS9 is running. For example I want to turn on the leds of a phidgets card when the landing gear goes down and turn them off when gear is up. I've already written a simple console program that uses FSUIPC client and reads the offset of the landing gear once and turns on the led [see below] but how do I have the program run all the time and wait for the gear to change and turn on the led? Do I use the c# Timer class to call Process() and use conditional statements or an event delegate type deal? Thanks Dazed and confused using System; using System.Collections.Generic; using System.Text; using Phidgets; using Phidgets.Events; using FSUIPC; using System.Threading; namespace FSUIPC_LED_Wrapper_dll { class Program { static LED myLed = new LED(); static void Main(string[] args) { myLed.open(); myLed.waitForAttachment(); try { FSUIPCConnection.Open(FlightSim.FS2K4); } catch (Exception ex) { Console.WriteLine(ex.Message); } Offset gearValue = new Offset(0x0BEB); FSUIPCConnection.Process(); Console.WriteLine("Gearup = 0 Gear down = 4194048 Value = {0}", gearValue.Value.ToString()); int gear = 4194048; if (gearValue.Value == gear) { myLed.leds[1] = 100; myLed.leds[2] = 100; myLed.leds[8] = 100; } Console.ReadKey(true); myLed.leds[1] = 0; myLed.leds[2] = 0; myLed.leds[8] = 0; FSUIPCConnection.Close(); myLed.close(); } } }
×
×
  • 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.