Flasher ?

mex_lithuaniamex_lithuania Junior MemberPosts: 31
Hey guys,

I'm wondering what is the best way to make a button/relay/etc on-off flasher?

I came up with few models, but the code is too big for such a simple task. I believe you have better solutions.

For example if we need to flash button for a specific time. And for this time we have a variable: flasherTime = 8; // 8 is for 8/10 sec

Ideas?

Comments

  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,155
    Probably the easiest way would be to create a flasher variable and then another variable o enable he thing.

    So something like
    
    define_program
    
    wait 7
    {
    flasher=!flasher
    }
    
    [tp_01,1]=flasher && button_fb_enable
    
    

    So, the idea is that you just turn on the varialbe button_fb_enable whenever you want the button to flash.
  • mex_lithuaniamex_lithuania Junior Member Posts: 31
    Love the simplicity. Good version.
    Thanks
    ericmedley wrote: »
    ...
  • ericmedleyericmedley Senior Member - 3709 Posts Posts: 4,155
    you're welcome.
  • josefinojosefino Junior Member Posts: 29
    Flasher

    Hey Eric is been a while I havent hear from you.
    Here is a simple code for blank screen that I was able to make with the help from Vinning, Eric, and Daniel.

    (***********************************************************)
    (* VARIABLE DEFINITIONS GO BELOW *)
    (***********************************************************)
    VOLATILE INTEGER FLASHER
    VOLATILE INTEGER PROJECTOR_MUTE_STATUS
    VOLATILE INTEGER nSource = 0

    (***********************************************************)
    (* THE EVENTS GO BELOW *)
    (***********************************************************)

    BUTTON_EVENT[dvTP,2] // System Off
    {
    PUSH:
    {
    SEND_STRING dvProjector,"$02,'POF',$03";
    g_bProj_Main_Power = 0;
    PROJECTOR_MUTE_STATUS = 0; //IT WOULD STOP FLASHING BUTTON
    SEND_STRING dvSwitcher,"'7!',$0D";

    BUTTON_EVENT[dvTP,55] //Shutter
    {
    PUSH:
    {
    PROJECTOR_MUTE_STATUS=!PROJECTOR_MUTE_STATUS;
    IF (PROJECTOR_MUTE_STATUS)
    {
    SEND_STRING dvProjector,"$02,'OSH:1',$03";
    }
    ELSE
    {
    SEND_STRING dvProjector,"$02,'OSH:0',$03";
    }
    }
    }

    (***********************************************************)
    (* THE ACTUAL PROGRAM GOES BELOW *)
    (***********************************************************)
    WAIT 7 // Changes the flasher state every .7 seconds
    {
    FLASHER=!FLASHER
    }

    [dvTP,55] = (PROJECTOR_MUTE_STATUS && FLASHER) // Flashes only if muted AND flashing enabled
  • TurnipTruckTurnipTruck Junior Member Posts: 1,485
    Get a little jiggier with it

    You can also use a send command to set the button's feedback state to blink.

    ^BFB-1,On
    ^BFB-1,Off
    ^BFB-1,Blink

    (1 is the button's address code in my example)

    I have used use this extensively for projector lamp status as well as alarm system arming up status.
  • josefinojosefino Junior Member Posts: 29
    Nice

    I will try it on m code, thanks
Sign In or Register to comment.