Hello Guest it is January 28, 2020, 09:34:00 AM

Author Topic: IsActive Function  (Read 2035 times)

0 Members and 1 Guest are viewing this topic.

Offline Dom

*
  •  22 22
    • View Profile
    • Bridgeport CNC Retrofit Blog
IsActive Function
« on: April 16, 2010, 09:30:35 AM »
I'm trying to write some vb script which applys some logic to a button press before giving a suitable output but I'm struggling to acknolwedge the button press. Ive been trawling the wiki and it seems like I need to use the IsActive function but I cant make it work for me. Would somone be kind enough to share some example code so I can see how it could be used 'in context' ?

Offline Tweakie.CNC

*
  • *
  •  8,110 8,110
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: IsActive Function
« Reply #1 on: April 16, 2010, 01:13:23 PM »
Hi Dom,

I presume you have read this but just need more examples.

IsActive
Function IsActive(Signal As Integer) As Boolean
This function returns a Boolean True if the current state of the specified input signal is its active state
Note that in terms of actual signal level, the term “active” depends on how the signal is defined. If the
signal is defined in Config->Ports&Pins->InputSignals as ActiveLow, then IsActive() will return True
when that signal is being driven to a logic low. If the signal is defined in Config->Ports&Pins-
>InputSignals as ActiveHigh, then IsActive() will return True when that signal is being driven to a logic
high.
Arguments:
Signal is an integer value corresponding to one of pre-defined input signal constants.
Return Value:
False indicates the signal is currently in its inactive state
True indicates the signal is currently in its active state

Example:
‘ Show the user the state of the INPUT #1 input
If IsActive(INPUT1) Then
Message “INPUT #1 input is active”
Else
Message “INPUT #1 input is inactive”
End If

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline Dom

*
  •  22 22
    • View Profile
    • Bridgeport CNC Retrofit Blog
Re: IsActive Function
« Reply #2 on: April 16, 2010, 07:22:23 PM »
Thanks for the reply and example. I'm sure I tried something like that but got a syntax error. I'll have a closer look tomorrow, maybe I was close but just did something silly.