-
Re: SIOC "IF" Question
Jack
Sorry for the delayed reply - the Mycockpit server fell out with me and I could not logon. Your code looks ok to me. Two suggestions - always use names not numbers when referencing variables and use lower numbers ie start from 10 - you will see why when using IOCPConsole ( when your mastercard comes:))
David
-
Re: SIOC "IF" Question
Hi David,
I have had to amend my script very slightly since the last post, just Offset changes, nothing major.
Anyway, I have a new question.
I want the LEDs to work like this:
If the precipitation is above a certain level, the LED lights up (it already does this). However, if the precipitation is above yet another level, I want it to blink/flash.
Nicos site does give advice on this but it is unfortunately timed. I want the LED to keep flashing until the precipitation has cleared (a "permenent" blink).
Any ideas?
-
Re: SIOC "IF" Question
Jack
Nico`s site does indeed have the answer! Look at the coding for "Stop a Blinking Led".
David
-
Re: SIOC "IF" Question
Sorry David, I don't know how I could interpose that. (It's for stopping not setting a Blinking LED?)
I want it to light up if Turbulence is more than 3, but blink instead of staying continuously lit.
-
Re: SIOC "IF" Question
Jack
Perhaps I am being dim, or too much beer (quite likely), but what part of the below quote does not contribute or provide direction to what you want?
"In this example a led starts blinking at the start of the SIOC program, but you can ofcourse also take other events to start the blinking of a led. The blinking is done with a TIMER, just as in the previous example. The difference is that we now program the Timer for a very long period, it counts down from 500.000 to 0 in steps of .4 seconds, long enough for a long haul flight ;-).
As soon as you push the button, the code attached to the button will force the Timer value to 1 step before the end value. In the next Timer operation the Timer will end and the blinking will stop"
David
-
Re: SIOC "IF" Question
Hi David,
Really sorry, but I think I don't physically understand Nico's statement. How could I adapt his code for my needs? I am confused because his script is focused on stopping an LED rather than making it blink continously.
-
Re: SIOC "IF" Question
Jack
The first part of the code under Var0 shows how to start a led blinking almost indefinately. The remainder of the code shows how to stop it under the control of a switch. So for your needs you only need to determine the logic to start the led blinking, then use Nico`s example, followed by using the "stop code" to suit your "trigger"
Look at the code , not the "title"
David
-
Re: SIOC "IF" Question
Hi David,
I've had a go and the script I've made looks & compiles okay. However, everything is far from complete. Basically, I do not know how to "join" the blink script and the standard LED light-up scripts together. This is because, whilst I probably could do the scripting, I just can't work it out in my head.
I'm wondering if you could have a little go for me? I would like the script to do the following:
- IF &Chain1 SW is ON, REF/OP SW is ON, and Turbulence is less than three, the LED illuminates. Otherwise, it is OFF if any one of those conditions are broken.
- Same as above, but if Turbulence is EQUAL OR MORE than three, then the LED Blinks instead of being lit. Otherwise, it is OFF/ON (but not blinking) if conditions are broken.
The current LED Lighting script:
Code:
Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED
Var 7002, name OP, Link IOCARD_OUT, Output 5 // OP LED
Var 9991, name OPSW, Link IOCARD_SW, Input 29, Type I // OP SW
Var 8881, name REFSW, Link IOCARD_SW, Input 28, Type I // REF SW
Var 9090, name Chain5, Link IOCARD_SW, Input 20 // Chain 5 Selector
Var 7890, name Chain4, Link IOCARD_SW, Input 26 // Chain 4 Selector
Var 7665, name Chain3, Link IOCARD_SW, Input 25 // Chain 3 Selector
Var 7605, name Chain2, Link IOCARD_SW, Input 24 // Chain 2 Selector
Var 7645, name Chain1, Link IOCARD_SW, Input 23 // Chain 1 Selector
Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
{
C0 = V9991 = 1
C1 = V8881 = 1
IF C0 OR C1
{
L0 = V9888 // FSUIPC L0 = v9888
IF L0 <= 3 // First sector
{
IF &Chain1 = 1 // 1 selected
{
&REF = 1
}
}
ELSE // Otherwise
{
&REF = 0 // Off
}
}
}
The Blinking LED script:
Code:
Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
{
C0 = V9991 = 1
C1 = V8881 = 1
IF C0 OR C1
{
L0 = V9888 // FSUIPC L0 = v9888
IF L0 >= 3 // First sector
{
IF &Chain1 = 1 // 1 selected
{
&REF = 0 OR 1
&BlinkLed = 500000 // begin value of timer
&BlinkLed = TIMER 0 -1 40
}
}
}
}
Var 9077, name BlinkLed
{
L0 = MOD &BlinkLed 2
IF L0 = 0
{
&REF = 0
}
ELSE
{
&REF = 1
}
}
How could I join them together whilst still achieving what I originally wanted? Could you try?
Thanks very much,
Jack
-
Re: SIOC "IF" Question
Jack
Sorry, but the best way is for you to persevere ( like many who have gone before you ), and when you get your Mastercard, to check what is happening (or not happening) - all as advised on previous threads. If you do not fully grasp this nettle, then you will not make progress and largely be reliant on others goodwill. I am happy to give advice on some specific issues, but do not have the time to provide a bespoke SIOC service
I do need to build my own cockpit!
David
-
Re: SIOC "IF" Question
Hi David,
I'm now facing a new, unrelated problem.
Whenever I try and import a .txt file to SIOC using the "Config" interface, I get the following error message:
http://i822.photobucket.com/albums/z...Untitled-5.jpg
I'm using the following SIOC Script, just for testing purposes:
Code:
// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : Weather Radar System.txt
// * Date : 14/08/2010
Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED
Var 7002, name OP, Link IOCARD_OUT, Output 5 // OP LED
Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
{
L0 = V9888 // FSUIPC L0 = v9888
IF L0 < 3 // First sector
{
&REF = 1
}
}
ELSE // Otherwise
{
&REF = 0 // Off
}
Var 9881, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
{
L0 = V9888 // FSUIPC L0 = v9888
IF L0 >= 3 // First sector
{
&REF = 0 OR 1
&BlinkLed = 500000 // begin value of timer
&BlinkLed = TIMER 0 -1 40
}
}
}
}
Var 9077, name BlinkLed
{
L0 = MOD &BlinkLed 2
IF L0 = 0
{
&REF = 0
}
ELSE
{
&REF = 0 OR 1
}
}
This problem is very annoying. I've tried renaming the txt file, making other copies of it in a different name (you can even see "yy.txt" file in background, this is a clone), stil lno luck. FSX/FSUIPC is not running, and the txt file I'm acessing is NOT open at the time of compiling. Any ideas?