Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Led code help

  1. #1
    25+ Posting Member
    Join Date
    Nov 2005
    Location
    Derby, UK
    Posts
    44
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Question Led code help

    Hi Nico,

    In order to use some annunciators on my MIP I have tried to code them without total success, if possible can you please have a look at coding them for me or giving me a point in the right direction..
    They are as follows:

    1) I would like to use the two annunciators below the thrust panel to light up to indicate that the seatbelts and no
    smoking switches are in the "off" position.
    I have only managed to get these to light up when the switches are in the "auto & on" positions. I would also like
    these to have cold & dark plus the lights test support.
    The main problem I have with these is that they require the variables 797 & 798 0 = Off to work in reverse in
    order for the led's to light.

    2) Brake source annunciator. I have tried using part of Edo's recent code for var 761 along with the addition of cold
    & dark plus the lights test support but I am unable to get it working correctly.
    My code for variable 949 reserve brakes is working correctly.

    I have tried various code for these along with cold & dark plus lights test support but could not get them to work.


    Regards
    Mick

  2. #2
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Mick,

    1) Here an example how to do that in "my style"
    Code:
    Var 797 Static
    {
      CALL &OutSeatbelt
    }
    
    
    Var 9001 name OutSeatbelt Link SUBRUTINE
    {
      IF &COldAndDark
      {
        &O_Seatbelt = 0
      }
      ELSE
      {
        IF &TestMip
        {
          &O_Seatbelt = 1
        }
        ELSE
        {
          IF v797 = 0   // Seatbelt switch in OFF position
          {
            &O_Seatbelt = 1
          }
          ELSE
          {
            &O_Seatbelt = 0
          }
        }
      }
    }
    
    Var 999 Static
    {
      CALL &OutSeatbelt
    }
    
    Var 9002 name O_Seatbelt Link IOCARD_OUT Output 91
    If you already have a refresh routine in your file, you may skip Var 999 and add the CALL to &OutSeatbelt to your Refresh routine.

    Same procedure applies to the No Smoking led.

    Maybe this will help you to solve your 2) problem too. If not I'll give it a try.

    regards,
    Nico
    Last edited by kiek; 05-07-2010 at 05:38 PM.

  3. #3
    25+ Posting Member
    Join Date
    Nov 2005
    Location
    Derby, UK
    Posts
    44
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Nico,

    Thanks for the code.
    I will try it tomorrow, have got to go out today.

    Regards
    Mick

  4. #4
    25+ Posting Member
    Join Date
    Nov 2005
    Location
    Derby, UK
    Posts
    44
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Nico,

    Still having a problem with the 2) code, I get an error when compiling which states ERROR! - A Var is expected
    Line: 2565 CALL OutBrkSrce
    ==> OutBrkSrce.

    I have tried changing the code around but still keeps reporting the same error.

    //***************************
    // 4.8 Reserve Brakes and Brake Source

    Var 949 STATIC
    {
    &O_Resbrake = TESTBIT v949 0
    }

    Var 350 STATIC name Res_Brake Link IOCARD_SW Device 1 Input 169 Type I
    {
    IF &ColdAndDark = 1
    {
    &O_Resbrake = 0
    }
    ELSE
    {
    IF &TestMIP = 1
    {
    &O_Resbrake = 1
    }
    ELSE
    {
    IF &Res_Brake = 1
    {
    &O_Resbrake = 1
    }
    }
    }
    }

    Var 4029 name O_Resbrake Link IOCARD_OUT Device 2 Output 9

    Var 761 STATIC
    {
    CALL OutBrkSrce
    }

    Var 4030 name OutBrkSrce Link subrutine
    {
    IF &COldAndDark
    {
    &O_BrkSource = 0
    }
    ELSE
    {
    IF &TestMip
    {
    &O_BrkSrce = 1
    }
    ELSE
    {
    C0 = V761 < 6
    C1 = &Res_Brake = 0
    IF C0 AND C1
    {
    &O_BrkSrce = 1
    }
    ELSE
    {
    &O_BrkSrce = 0
    }
    }
    }

    Var 4031 name O_BrkSrce Link IOCARD_OUT Device 2 Output 10


    Can you please have a look at it, I will then try both lots of code.

    Regards
    Mick

  5. #5
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    You miss an ampersand, it should read:

    Code:
    CALL &OutBrkSrce

  6. #6
    25+ Posting Member
    Join Date
    Nov 2005
    Location
    Derby, UK
    Posts
    44
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Nico,

    I have now tried both lots of code and the led's are not lighting up at all in any position/mode. The reserve brakes part is working ok.

    //*****************************************************************
    // 2.22 Passenger Signs

    Var 797 STATIC
    {
    CALL &OutSeatbelt
    }

    Var 3408 name OutSeatbelt Link SUBRUTINE
    {
    IF &COldAndDark
    {
    &O_Seatbelt = 0
    }
    ELSE
    {
    IF &TestMip
    {
    &O_Seatbelt = 1
    }
    ELSE
    {
    IF v797 = 0 // Seatbelt switch in OFF position
    {
    &O_Seatbelt = 1
    }
    ELSE
    {
    &O_Seatbelt = 0
    }
    }
    }
    }

    Var 3409 name O_Seatbelt Link IOCARD_OUT Device 2 Output 24

    Var 798 STATIC
    {
    CALL &OutNoSmoke
    }

    Var 3410 name OutNoSmoke Link SUBRUTINE
    {
    IF &COldAndDark
    {
    &O_NoSmoke = 0
    }
    ELSE
    {
    IF &TestMip
    {
    &O_NoSmoke = 1
    }
    ELSE
    {
    IF v798 = 0 // NoSmoke switch in OFF position
    {
    &O_NoSmoke = 1
    }
    ELSE
    {
    &O_NoSmoke = 0
    }
    }
    }
    }

    Var 3411 name O_NoSmoke Link IOCARD_OUT Device 2 Output 23

    //***************************
    // 4.8 Reserve Brakes and Brake Source

    Var 949 STATIC
    {
    &O_Resbrake = TESTBIT v949 0
    }

    Var 350 STATIC name Res_Brake Link IOCARD_SW Device 1 Input 169 Type I
    {
    IF &ColdAndDark = 1
    {
    &O_Resbrake = 0
    }
    ELSE
    {
    IF &TestMIP = 1
    {
    &O_Resbrake = 1
    }
    ELSE
    {
    IF &Res_Brake = 1
    {
    &O_Resbrake = 1
    }
    }
    }
    }

    Var 4029 name O_Resbrake Link IOCARD_OUT Device 2 Output 9

    Var 761 STATIC
    {
    CALL &OutBrkSrce
    }

    Var 4030 name OutBrkSrce Link subrutine
    {
    IF &COldAndDark
    {
    &O_BrkSrce = 0
    }
    ELSE
    {
    IF &TestMip
    {
    &O_BrkSrce = 1
    }
    ELSE
    {
    C0 = V761 < 6
    C1 = &Res_Brake = 0
    IF C0 AND C1
    {
    &O_BrkSrce = 1
    }
    ELSE
    {
    &O_BrkSrce = 0
    }
    }
    }
    }

    Var 4031 name O_BrkSrce Link IOCARD_OUT Device 2 Output 10

    //===============================================================
    // Refresh
    //****************

    Var 999 Static
    {
    CALL &OutSeatbelt
    CALL &OutNoSmoke
    CALL &OutBrkSrce
    }

    Regards
    Mick

  7. #7
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Mick,
    Are you running lekseecon v6?

    Please post your log file...

    (and please put CODE around your code in postings, will make it al lot easier to read and copy)

    Regards,
    Nico

  8. #8
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Mick,
    Another thing, your Res Brake code is not completely correct, you better change it to:

    Code:
    Var 949 STATIC
    {
      CALL &OutResBrake
    }
    
    Var 350 STATIC name Res_Brake Link IOCARD_SW Device 1 Input 169 Type I
    
    Var 4028 name OutResBrake Link SUBRUTINE
    {
      IF &ColdAndDark = 1
      {
        &O_Resbrake = 0
      }
      ELSE
      {
        IF &TestMIP = 1
        {
          &O_Resbrake = 1
        }
        ELSE
        {
          C0 = TESTBIT v949 0
          IF C0
          {
            &O_Resbrake = 1
          }
          ELSE
          {
            &O_Resbrake = 0
          }
        }
      }
    }
    
    Var 4029 name O_Resbrake Link IOCARD_OUT Device 2 Output 9
    and add CALL &OutResBrake to var 999

  9. #9
    25+ Posting Member
    Join Date
    Nov 2005
    Location
    Derby, UK
    Posts
    44
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Nico,

    Yes I am running v6.0.
    Sorry did not know about using code when listing code.

    I have changed the reserve brakes code, ran it and here is my log file.

    Copyright (c) 2007-2010 Nico W. Kaan

    Prog: lekseeconX version 6.0
    PC: SERVER D:\lekseecon
    PF: C:\Program Files (x86)
    PF86: C:\Program Files (x86)

    D:\SIOC\sioc.ini found.
    Looking up hostaddress of SERVER, type:AF_INET, length:4, ip:192.168.2.2
    HOSTADDRESS=192.168.2.2
    PORT=8092
    CONFIG_FILE=D:\SIOC\sioc.ssi

    495 LevelD767 Vars were detected in your CONFIG_FILE:
    13 14 15 16 18 19 20 22 23 24 25 27 28 29 30 32 33 34 35 39
    40 43 44 49 50 51 52 53 54 55 57 58 59 61 62 63 65 66 67 68
    70 71 72 73 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91
    92 93 94 95 96 97 98 100 101 102 103 104 106 107 108 110 111 115 116 125
    126 127 128 129 130 131 132 136 137 138 139 140 141 145 146 151 152 153 154 155
    156 157 158 160 161 162 163 164 165 166 167 168 170 171 172 174 175 176 178 179
    182 183 184 189 190 191 195 196 197 198 199 200 201 202 204 205 206 207 208 209
    210 211 213 214 215 216 217 218 219 220 222 223 224 225 226 228 229 230 231 232
    240 241 242 243 244 245 249 255 256 257 258 259 260 261 262 263 264 265 266 267
    268 270 271 272 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
    290 291 292 293 294 295 296 297 298 299 307 308 309 311 312 313 314 315 316 317
    319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 339
    340 341 342 344 345 346 347 348 350 351 352 353 354 355 356 357 358 360 361 362
    363 364 365 366 367 368 369 370 372 373 374 375 376 377 378 379 380 382 383 384
    385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
    405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
    425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
    445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 464 465
    466 467 468 469 470 476 477 478 479 503 504 505 506 507 509 510 511 515 516 517
    518 519 523 525 527 528 529 530 531 532 533 534 535 536 537 538 540 541 542 543
    544 545 546 547 548 549 550 551 564 565 569 570 571 572 573 574 575 576 577 578
    579 580 581
    700 701 702 703 704 705 706 707 710 711 714 715 716 717 718 722 724 725 726 728
    729 733 736 737 738 739 740 741 742 751 761 762 764 766 769 770 771 772 775 779
    780 781 782 797 798 822 828 829 830 831 832 833 834 835 836 837 838 840 841 842
    843 844 845 849 852 853 854 855 856 949 976 999

    SIOC connected.
    Connecting to SDK
    SDK connected.
    Link established to FSX via Simconnect.
    No info about Rotary Switch 27:30, forced to 27 (rotswitches.ini).
    No info about Rotary Switch 94:98, forced to 96 (rotswitches.ini).
    No info about Rotary Switch 110:111, forced to 110 (rotswitches.ini).
    No info about Rotary Switch 156:158, forced to 156 (rotswitches.ini).
    No info about Rotary Switch 222:226, forced to 223 (most likely?).
    No info about Rotary Switch 346:348, forced to 347 (most likely?).
    No info about Rotary Switch 351:358, forced to 352 (rotswitches.ini).
    No info about Rotary Switch 373:380, forced to 373 (rotswitches.ini).
    No info about Rotary Switch 536:538, forced to 537 (most likely?).
    No info about Rotary Switch 540:542, forced to 540 (rotswitches.ini).
    A 2 dual Rotary Encoders COMM1 detected.
    A 2 dual Rotary Encoders COMM2 detected.
    Running...
    SIOC disconnected.
    Running Exit: connection to SIOC was lost.
    lekseeconX stopped.


    Regards
    Mick

  10. #10
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Led code help

    Hi Mick,
    Your log looks fine, all relevant Vars are there...
    Q: What happens if you activate lights test at your MIP, do the seatbelt and nosmoking light up?
    Nico
    Last edited by kiek; 05-09-2010 at 08:13 AM.

Page 1 of 2 12 LastLast

Similar Threads

  1. making g-code
    By flatlandpilot in forum CNC Discussion
    Replies: 2
    Last Post: 04-28-2010, 10:38 AM
  2. I Need Help Bad My Code Has Changed!!!
    By christianpilot1 in forum PM General Q & A
    Replies: 4
    Last Post: 08-06-2007, 02:22 PM