I'm a bit surprised you only want one light and not a Master Warning Panel of some kind. The fun part is that in a variable, the bits add up to numbers and you can use a switch-case to go right to the code for this-and-this-but-not-that-etc-for-many-conditions-combined and set a flag for the output to turn the led on or off. If what you should send to FSX depends on multiple conditions then you can have your input code set bits in a variable, each bit is a true/false, and when your process code sees certain combinations of bits, it will trigger. And only in the last step, after all processing logic has been worked through, you finally set the outputs accordingly to their logical state after processing all conditions you want to have evaluated. insert more output settings of logical states to physical devices hereĭuring the "processing" part of the code you then can change the state of variables several times if you like, without anything to happen at the physical outputs. If (manifold_pressure<14 & gear_position= GEARUP) ledState=true Int manifold_pressure= readPressureSensor() So with an LED that depends on the two conditions "manifold pressure" and "gear position", the pseudo logic would go something like that: void loop() Output() // actually switch the logical state to the physical state on the output devices.Processing() // do logical processing of logical output states in variables only.Input() // read all necessary input from Serial, buttons and sensors and save input states in variables.I didn't look through your code, but from your description I'd say that the solution would be to seperate the logical state of your LED from the physical state, and you do that by using the IPO programming logic for the loop() function. There is lots more on there as it runs my annunciator panel but I am looking at switch case 'Q' & 'Y' Ill post what code I have go so far in the hope that someone can help. I can get them to work as separate switch cases but not together. Therefore for that LED to come on two conditions have to be met my Manifold pressure has to drop and my gear has to be up but I have no Idea how to code it. So on the aircraft I fly if I drop my manifold pressure below 14inHG whilst my gear is up I get an LED come on. My trouble is trying to get multiple switch cases to feed into one LED. From the outputs it read data from FSX and when that data reaches a certain parameter it digitalWrites a pin to activate an LED or an alarm. Basically it works an input by sending a Serial.println to Link2fs which makes the control in the simulator. I am using a programme called Link2fs which if you are not familiar with it acts as an interface programme between arduino and FSX. Having a bit of trouble which Ill try and explain the best I can.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |