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

Thread: Timed Button

  1. #1
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503

    Timed Button

    I've been trying to make a timed momentary button but with no success. I don't see anything in the Configurator to add a timer to just that button. I want to click it and then it activates the output for like 15 seconds. I tried changing the minimum_delta_vote_time on the upclick properties but it doesnt work as planned.

  2. #2
    Fusion Brain Creator
    Join Date
    Mar 2005
    Posts
    2,221
    use the button to set a variable to some number, then logic that decrements that variable every processing cycle. once that reaches 0, logic to set the output to off

  3. #3
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503
    So if the logic timer is set for 100 that would mean that it would run the logic 10 times in one second, correct?

    So if i made a button that sets a variable to 50 then a logic statement that

    "IF variable > 0 THEN output on AND -1"

    and another one

    "IF variable = 0 THEN output off"

    that it should take around 5 seconds for it to run through all that 50 times and shut it off?

  4. #4
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Quote Originally Posted by bratnetwork View Post
    So if the logic timer is set for 100 that would mean that it would run the logic 10 times in one second, correct?

    So if i made a button that sets a variable to 50 then a logic statement that

    "IF variable > 0 THEN output on AND -1"

    and another one

    "IF variable = 0 THEN output off"

    that it should take around 5 seconds for it to run through all that 50 times and shut it off?
    yup. exactly.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  5. #5
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503
    Ok here is what I have:

    Button:
    Code:
    <button id="WINDOWS_DOWN" enabled="yes" function="change variable" functionTargetID="window_timing" vote_opinion="51" vote_priority="Medium">
            <images imagePrimary="content\images\button_images\button_down.png" imageSecondary="content\images\button_images\button.png" imageDisabled="content\images\button_images\button.png" imagePushed="content\images\button_images\button_down.png"></images>
            <display size="230,70" location="287,75" page="0" z_order="0.9"></display>
            <vote_options minimum_delta_vote_time_down="20"></vote_options>
            <text font="verdana" font_size="25"></text>
            <text colourPrimaryARGB="255,255,255,255" textPrimary="Windows Down"></text>
            <text colourSecondaryARGB="255,255,255,255" textSecondary="Windows Down"></text>
          </button>
    And the logic:
    Code:
    <if fire_on="logic" minimum_delta_vote_time="100" id="window_timer_logic">
            <boolean_operation type="greater than">
              <parameter1>
                <variable do="get" name="window_timing"></variable>
              </parameter1>
              <parameter2>
                <number>0</number>
              </parameter2>
            </boolean_operation>
            <then>
              <do function="Trigger Output" functionTargetID="Digital Output 5" vote_opinion="On" vote_priority="Medium"></do>
    		  <do function="Change Variable" functionTargetID="window_timing" vote_opinion="-1" vote_priority="Medium"></do>
            </then>
          </if>
          <if fire_on="logic" minimum_delta_vote_time="100" id="window_stop_logic">
            <boolean_operation type="equal to">
              <parameter1>
                <variable do="get" name="window_timing"></variable>
              </parameter1>
              <parameter2>
                <number>0</number>
              </parameter2>
            </boolean_operation>
            <then>
              <do function="Trigger Output" functionTargetID="Digital Output 5" vote_opinion="Off" vote_priority="Medium"></do>
            </then>
          </if>
    I have the logic timer in the timers section set at 100.

    When I click the button the output goes on once for a split second. I can click it over and over and it still does it, so it seems to be reseting but not staying on for the planned amount of time.

  6. #6
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503
    bump

  7. #7
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Sorry, I havent forgotten about you. I have a large Verilog project to design a virtual CPU and synthesize it so I have been a bit busy. Hopefully Monday night I will get some code for you.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  8. #8
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503
    ok thanks

  9. #9
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    setting variable to "-1" sets it to negative one.

    Setting a variable to "d-1" changes it to variable - 1.

    Also you have your clear logic set to medium priority and your button set to medium priority.

    When the variable is at rest, it is equal to zero, so that logic tries to assert off. If you press your button, it will try to change it on. So if they occur on the same clock cycle, nothing will happen. This configuration will give you spurradic behaviour. Change the logic set to zero to low priority and the button to high priority.

    Also I have been working on 3 new features for the digital outputs that will make it easy. Pulse output, Sequential Output, and Relatively Timed Sequential Output.

    I have 2 of 3 finished, working on the last. Let me know if those changes fix it.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  10. #10
    Maximum Bitrate bratnetwork's Avatar
    Join Date
    Oct 2007
    Location
    Haledon, NJ
    Posts
    503
    Yes that did the trick. Works great now...

    Now the problem I'm having is that I can't get it to upclick... it doesnt automatically upclick when the output is set to off, and I tried adding an upclick property to the button and it still wouldn't upclick. I don't care if it upclicks when the sequence is over or when my finger comes off the button.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 34
    Last Post: 11-06-2007, 02:42 PM
  2. Button request: Minimize
    By DaveB in forum Mobile Impact
    Replies: 17
    Last Post: 01-04-2007, 08:35 PM
  3. iGmod Beta 2 release
    By PURDooM in forum Other Cool Stuff
    Replies: 625
    Last Post: 05-12-2006, 02:52 PM
  4. Forum Really Slow
    By Quattro in forum Mp3car Forum Suggestions/Comments
    Replies: 58
    Last Post: 05-10-2005, 03:04 PM
  5. Replies: 2
    Last Post: 04-04-2005, 03:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •