Hello Guest it is March 28, 2024, 03:41:53 PM

Author Topic: Use button click as brain input?  (Read 3162 times)

0 Members and 1 Guest are viewing this topic.

Use button click as brain input?
« on: April 16, 2010, 12:17:45 PM »
I need to momentarily pulse an output when the reset button is clicked.  Can I use a brain for this?  I can't see any applicable option to start a rung with...Can I get to a button state?

Thanks

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Use button click as brain input?
« Reply #1 on: April 20, 2010, 04:35:28 AM »
yes, in Screen designer, open the screen and goto the page that has the button you want, to use.
in the button put some VB like this (and I would recommend dropping a User LED next to the button, you will use the User LED as your trigger.

in the button put (user LED 1500 used as example)

If Not(GetUserLED(1500)) Then
SetUserLED(1500,1)
End IF

Then in a brain, I would do this, put ULED 1500 as an input, then it goes to a "Timer" set the timer for the pulse you want and type, and its output going to a termination of the Output you want to turn on.

THEN I would do a second Rung in the Brian, in where the OUTPUT that you turned on above is the input on the second rung. have it ALSO go to a timer BUT it will trigger at some time AFTER the 1st timer triggers, when it triggers have it feed to a fomula like A*0 then that output to UserLED1500 this will turn off your trigger LED for you after a set time.

OR, you can put a statement in your trigger button that turns it off, but then you would have to turn off your trigger LED by pushing the button again, after you turned it on.

i.e.

If Not(GetUserLED(1500)) Then
SetUserLED(1500,1)
else
SetUserLED(1500,0)
End IF

'Scott
fun times