---
title: "Versatile (_Versatile class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/522223711/Versatile%20(_Versatile%20class)"
format: markdown
---
> Macro (toc)

---

# Close

This function switches output ON. 

#### Syntax 

```visualbasic
Function Close() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V1.Close()
```

This command switches the V1 output ON. 

# ClosePulse

This function switches output ON and after **pulsetime** switches it OFF. 

#### Syntax 

```visualbasic
Function ClosePulse(pulsetime As Time) As Boolean
```

#### Parameters 

pulsetime 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> It is a time of the pulse. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V1.ClosePulse(:1.0)
```

This command switches the V1 output ON and after one second switches it OFF. 

# GetDigitalLeadingEdgeAppeared

The function returns an appearance of a leading edge on a channel. 

#### Syntax 

```visualbasic
Function GetDigitalLeadingEdgeAppeared() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if since the last call to this command the input has been ever in active level (the leading edge appeared), False otherwise. If this command has not been called yet, then the starting point is the beginning of the digital measurement. 

#### Example 

```visualbasic
If V1.GetDigitalLeadingEdgeAppeared() Then  
  DebugPrint("V1 input has been active since last time") 
Else 
  DebugPrint("V1 input has not been active since last time ") 
End If
```

# GetDigitalLevel

The function returns True if the input is in active level and False otherwise. 

#### Syntax 

```visualbasic
Function GetDigitalLevel() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the input is in active level, False otherwise. 

#### Example 

```visualbasic
Var Level1 As Boolean  

Level1 := V1.GetDigitalLevel()
```

There is a current digital level on the V1 channel in the variable Level1. 

# GetDigitalPulseCount

The function returns the number of transitions from an inactive to an active level on a channel. 

#### Syntax 

```visualbasic
Function GetDigitalPulseCount(Optional clearpulsecount As Boolean := False) As Long
```

#### Return value 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the number of transitions from an inactive to an active level. If clearpulsecount = true, then the counter resets and counts again. The maximum number of pulses is determined by the maximum positive value of Long numbers. 

#### Example 

```visualbasic
Var PulseCount1 As Long  

PulseCount1 := V1.GetDigitalPulseCount()
```

The variable PulseCount1 is the current number of transitions from an inactive to an active level on a V1 channel. 

# GetResistance

The function returns the value (in Ohm) of resistance connected to the versatile channel. The measurement of resistance must be activated before with the function StartResistanceMeasurement. 

#### Syntax 

```visualbasic
Function GetResistance() As Double
```

#### Return value 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the resistance on the channel. 

#### Example 

```visualbasic
Var Resistance1 As Double 

Resistance1 := V1.GetResistance()
```

In the variable Resistance1, there is a current resistance on a V1 channel. 

# GetVoltage

This function returns the current voltage (in Volt) of the signal pin of the versatile channel. The measurement of voltage must be activated before with the function StartVoltageMeasurement. 

#### Syntax 

```visualbasic
Function GetVoltage() As Double
```

#### Return value* *

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the voltage on the channel. 

#### Example 

```visualbasic
Var Voltage1 As Double 

Voltage1 := V1.GetVoltage()
```

In the variable Voltage1 is a current voltage on a V1 channel. 

# IrSend

The function sends IR data to the Versatile channel. If a parameter repeatuntilstop is True, it sends the data repeatedly until a function StopIrSend is called. 

#### Syntax 

```visualbasic
Function IrSend( 
  irdata As _IrData, 
  Optional repeatuntilstop As Boolean := False) 
As Boolean
```

#### Parameters 

irdata 

_IrData It is the data to be sent. 

repeatuntilstop 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> Optional, defaults to False. If it is False, the data is sent only once. If it is True, the data is sent repeatedly until a function StopIrSend is called. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

# IrSendFromByteString

The function sends IR data from ByteString. If a parameter repeatuntilstop is True, it sends the data repeatedly until a function StopIrSend is called. 

#### Syntax 

```visualbasic
Function IrSendFromByteString( 
  irdata As ByteString, 
  Optional repeatuntilstop As Boolean := False) 
As Boolean
```

#### Parameters 

irdata 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u>. It is the ByteString with IR data to be sent. Command IrCaptureToByteString can be used to create ByteString with IR data. 

repeatuntilstop 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> Optional, defaults to False. If it is False, the data is sent only once. If it is True, the data is sent repeatedly until a function StopIrSend is called. 

# IrSendFromFile

The function sends IR data from the file to the IR channel. If a parameter repeatuntilstop is True, it sends the data repeatedly until a function StopIrSend is called. 

#### Syntax 

```visualbasic
Function IrSendFromFile( 
  Filename As Text, 
  Optional repeatuntilstop As Boolean := False) 
As Boolean
```

#### Parameters 

filename 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u>. It is the file name with IR data to be sent. Command IrCaptureToFile can be used to create a file with IR data. 

repeatuntilstop 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> Optional, defaults to False. If it is False, the data is sent only once. If it is True, the data is sent repeatedly until a function StopIrSend is called. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. These errors can happen: <u>[600](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#600)</u>, <u>[601](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#601)</u>, <u>[602](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#602)</u>, <u>[603](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#603)</u>, <u>[604](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#604)</u>. 

# IsClosed

The function returns if a channel is closed or opened. 

#### Syntax 

```visualbasic
Function IsClosed() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the channel is closed, False otherwise. 

#### Example 

```visualbasic
If V1.IsClosed() Then 
  DebugPrint("V1 is closed now") 
Else 
  DebugPrint("V1 is open now") 
End If
```

# IsPullupOn

The function returns if a pullup is ON or OFF. 

#### Syntax 

```visualbasic
Function IsPullupOn() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the pullup is ON, False otherwise. 

#### Example 

```visualbasic
If V1.IsPullupOn() Then 
  DebugPrint("V1 Pullup is ON") 
Else 
  DebugPrint("V1 Pullup is OFF") 
End If
```

# Open

This function switches output OFF. 

#### Syntax 

```visualbasic
Function Open() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V4.Open()
```

This command switches the V4 output OFF. 

# PullupOff

This function switches a pullup OFF. 

#### Syntax 

```visualbasic
Function PullupOff() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V4.PullupOff()
```

This command switches V4 pullup OFF. 

# PullupOn

This function switches a pullup ON. 

#### Syntax 

```visualbasic
Function PullupOn() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example* *

```visualbasic
V2.PullupOn()
```

This command switches V2 pullup ON. 

# Send

The function sends data to the Versatile channel. It returns True on success or False if data is not accessible. 

#### Syntax 

```visualbasic
Function Send(data As ByteString) As Boolean
```

#### Parameters 

data 

<u>[ByteString](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString)</u> It is the data to be sent. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if data is not accessible. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

# SetCarrier

The function modes the Versatile channel for sending with or without a carrier. 

#### Syntax 

```visualbasic
Function SetCarrier(enable As Boolean) As Boolean
```

#### Parameters 

enable 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It enables (True) or disables (False) the carrier. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

# SetOutputState

The function sets the complex output state of the channel with optional interruption of the currently running program. 

#### Syntax 

```visualbasic
Function SetOutputState( 
  outputstate As _VersatileOutputState, 
  Optional stopoutputprogram As Boolean := True) 
As Boolean
```

#### Parameters 

outputstate 

<u>_VersatileOutputState</u> <u>[Structure](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Structure)</u> It defines the output value of the channel. It is possible individually set up all three of the active elements of the output channel, i.e. Close, Pullup and Pulldown switches. For each of the switches can be defined, whether it should be closed, open, or left in the current state. See <u>_VersatileOutputControl</u> <u>[Enum](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Enum)</u> for more details. 

stopoutputprogram 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> If True it interrupts the currently running program. If False currently running program is not affected. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

Relay with potential free input contacts is connected to V1 

```visualbasic
// switch versatile output to close state 
Var outputstate As _VersatileOutputState 

outputstate.Close := _VersatileOutputControl.On  
outputstate.Pulldown := _VersatileOutputControl.Off 
outputstate.Pullup := _VersatileOutputControl.Off 
V1.SetOutputState(outputstate, True)
```

The command switches versatile V1 output to close state and thus closes the relay contacts. 

# SetSerialParameters

The function sets the communication parameters of the Versatile channel. 

#### Syntax 

```visualbasic
Function SetSerialParameters( 
  mode As Byte, 
  bitspersecond As Long, 
  databits As Byte, 
  parity As Byte, 
  stopbits As Byte, 
  flowcontrol As Byte, 
  ParamArray) As Boolean
```

#### Parameters 

mode 

<u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u> It is the mode of the channel. Predefined constants for parameter mode are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _SERIAL_MODE_RS232 | 0 | Channel is in RS-232 mode. |

bitspersecond 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the baud rate from 300 to 115200. 

databits 

<u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u> It is the number of data bits from 5 to 8. 

parity 

<u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u> It is the type of parity. Predefined constants for parameter parity are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _SERIAL_PARITY_NO | 0 | No parity. |
| _SERIAL_PARITY_ODD | 1 | Odd parity. |
| _SERIAL_PARITY_EVEN | 2 | Even parity. |

stopbits 

<u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u> It is the number of stop bits. Predefined constants for parameter stopbits are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _SERIAL_STOPBITS_ONE | 0 | One stop bit. |
| _SERIAL_STOPBITS_ONEANDHALF | 1 | One and a half stop bits. |
| _SERIAL_STOPBITS_TWO | 2 | Two stop bits. |

flowcontrol 

<u>[Byte](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)</u> It is the type of the control. Predefined constants for parameter flowcontrol are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _SERIAL_FLOWCONTROL_NONE | 0 | No handshake. |
| _SERIAL_FLOWCONTROL_DELAY | 4 | Specifies the delay time between bytes. It must be specified in the next parameter ParamArray. |

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are parameters of the flow. The number and types of these parameters depend on previous parameter flowcontrol if _SERIAL_FLOWCONTROL_DELAY is used. 

- _SERIAL_FLOWCONTROL_DELAY is used as the flowcontrol:

timedelay 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> It is the delay time between bytes. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Examples 

Channel V1 is in RS-232 mode, 9600 bits per second, 8 data bits, no parity, one stop bit, and no handshake. 

```visualbasic
V1.SetSerialParameters( 
  _SERIAL_MODE_RS232, 
  9600, 
  8, 
  _SERIAL_PARITY_NO, 
  _SERIAL_STOPBITS_ONE, 
  _SERIAL_FLOWCONTROL_NONE)
```

Channel V1 is in RS-232 mode, 9600 bits per second, 8 data bits, no parity, one stop bit, specifies the delay time between bytes. The time delay is 1 second. 

```visualbasic
V1.SetSerialParameters( 
  _SERIAL_MODE_RS232, 
  9600, 
  8, 
  _SERIAL_PARITY_NO, 
  _SERIAL_STOPBITS_ONE, 
  _SERIAL_FLOWCONTROL_DELAY, 
  :1)
```

# StartDigitalSignalMeasurement

The function switches the channel to digital input mode and pulse counter. Only in this mode, commands GetDigitalLeadingEdgeAppeared, GetDigitalLevel, GetDigitalPulseCount, WaitForDigitalLeadingEdge, WaitWhileDigitalLevelActive, work. 

#### Syntax 

```visualbasic
Function StartDigitalSignalMeasurement( 
  Optional samplingperiod As Time := :0.01, 
  Optional threshold As Long := _DigitalThreshold.V_6, 
  Optional activelevel As Boolean := _DIGITAL_LEVEL_HIGH, 
  Optional filter As Long := 3) 
As Boolean
```

#### Parameters 

samplingperiod 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> It is a time delay between individual measurement samples. Recommended sampling period depends on the rate of change of the input signal. The sampling period should be at least 2 times shorter than the fastest input signal change. 

threshold 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It determines the decision level (threshold) of the input circuit. It is possible to use a threshold of 1.5 V or 6 V. Predefined ranges are available as <u>_DigitalThreshold</u> <u>[Enum](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Enum)</u> values. 

activelevel 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It determines if the active level on a channel is higher or lower than the threshold voltage. This affects the behavior of commands GetDigitalLeadingEdgeAppeared, WaitForDigitalLeadingEdge, WaitForDigitalLeadingEdge and GetDigitalPulseCount. Predefined constants for parameter activelevel are as follows: 

|  |  |  |
| --- | --- | --- |
| Name | Value | Description |
| _DIGITAL_LEVEL_HIGH | True | Active level is above the threshold voltage. |
| _DIGITAL_LEVEL_LOW | False | Active if the level is below the threshold voltage. |

filter 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It affects the filtering of the measuring channel. It can be set in the range of 0-16. Value 0 means do not filter, 16 is the maximum filtration. A higher value means a more stable result of filtration, but a slower response to fast changes in the input. The level of filtration affects the number of sampling periods, for which there is a steady response to a step change in the input signal. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V1.StartDigitalSignalMeasurement( 
  :0.05, 
  _DigitalThreshold.V_1_5, 
  _DIGITAL_LEVEL_LOW, 
  5)
```

Channel V1 is in digital measurement mode. Sampling is done with a 50 ms period and the input threshold is 1.5 V. Active level is logical zero. The resulting value is filtered with a filtration degree of 5. 

# StartResistanceMeasurement

The function switches the channel to the resistance measurement mode. To execute commands based on resistance measurements, the input of the channel must be in this mode. This function affects the output of the channel - turns off the output section. 

The measuring range is 0-200KΩ. Available ranges are 0-2 KΩ, 0-20 KΩ, 0-200 KΩ. For resistance measurement, the channel is equipped with automatic range switching. 

#### Syntax 

```visualbasic
Function StartResistanceMeasurement( 
  Optional samplingperiod As Time := :0.1, 
  Optional range As Long := _ResistanceRange.Auto, 
  Optional filter As Long := 8) 
As Boolean
```

#### Parameters 

samplingperiod 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> It is a time delay between individual measurement samples. Recommended sampling period depends on the rate of change of the measured resistance. The sampling period should be at least 10 times shorter than the period of the change of the resistance. 

range 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It affects the measuring range. It is possible to use a range of 0 - 2 KΩ, 0 - 20 KΩ, 0 - 200 KΩ, or automatic range switching according to the value of the measured resistance. Predefined ranges are available as <u>_ResistanceRange</u> <u>[Enum](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Enum)</u> values. 

filter 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It affects the filtering of the measuring channel. It can be set in the range of 0-16. Value 0 means do not filter, 16 is the maximum filtration. A higher value means a more stable result of filtration, but a slower response to fast changes in the input. The level of filtration affects the number of sampling periods, for which there is a steady response to a step change in the measured value. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V1.StartResistanceMeasurement( 
  :0.2, 
  _ResistanceRange.R_20K, 
  10)
```

Channel V1 is in resistance measurement mode. Sampling is done with a 200 ms period in the input resistance range 0 - 20 KΩ. The resulting value is filtered with a filtration degree of 10. 

# StartVoltageMeasurement

The function switches the channel to the voltage measurement mode. To execute commands based on voltage measurement, the input of the channel must be in this mode. It does not affect the output of the channel. This is the default mode.  

The measuring range is 0 - 10 V. For voltage measurement the channel is equipped with automatic range switching. When measuring voltage above 2.5 V an input voltage divider is used. 

#### Syntax 

```visualbasic
Function StartVoltageMeasurement( 
  Optional samplingperiod As Time := :0.01, 
  Optional range As Long := _VoltageRange.Auto, 
  Optional filter As Long := 9) 
As Boolean
```

#### Parameters 

samplingperiod 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> It is a time delay between individual measurement samples. Recommended sampling period depends on the rate of change of the input signal. The sampling period should be at least 10 times shorter than the period of the input signal. 

range 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It affects the measuring range. It is possible to use a range of 0 - 2.5 V, 0 - 10 V, or automatic range switching according to the magnitude of the input signal. Predefined ranges are available as <u>_VoltageRange</u> <u>[Enum](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Enum)</u> values. 

filter 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It affects the filtering of the measuring channel. It can be set in the range of 0-16. Value 0 means do not filter, 16 is the maximum filtration. A higher value means a more stable result of filtration, but a slower response to fast changes in the input. The level of filtration affects the number of sampling periods, for which there is a steady response to a step change in the input signal.  

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

```visualbasic
V1.StartVoltageMeasurement( 
  :0.05, 
  _VoltageRange.V_2_5, 
  10)
```

Channel V1 is in voltage measurement mode. Sampling is done with a 50 ms period in the input voltage range 0 - 2.5 V. The resulting value is filtered with a filtration degree of 10. 

# StopIrSend

The function stops sending IR data to the Versatile channel started by the function IrSend. 

#### Syntax 

```visualbasic
Function StopIrSend() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True on success or False if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

# WaitForDigitalLeadingEdge

The function waits for a leading edge on the channel until the **timeout** elapsed. The leading edge is the transition from the inactive to the active level. 

#### Syntax 

```visualbasic
Function WaitForDigitalLeadingEdge(Optional timeout As Time := _TIME_INFINITE) As Boolean
```

#### Parameters 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the leading edge appeared. If this happens the memory of the appearance of the leading edge is erased. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example* *

The command waits for the first appearance of the leading edge. 

```visualbasic
V8.StartDigitalSignalMeasurement() 
// wait for the first appearance of the leading edge 
V8.WaitForDigitalLeadingEdge()
```

# WaitWhileDigitalLevelActive

The function waits while the input signal on the channel is in the active level and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileDigitalLevelActive(Optional timeout As Time := _TIME_INFINITE) As Boolean
```

#### Parameters 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the function is finished before the timeout has passed. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example* *

The command waits as long as the input signal on the channel is at the active level. 

```visualbasic
V8.StartDigitalSignalMeasurement() 
// wait while the input signal is in the active level 
V8.WaitWhileDigitalLevelActive()
```

# WaitWhileResistanceAbove

The function waits while the measured value lies above **resistance** and until the **timeout** elapsed. 

#### Syntax* *

```visualbasic
Function WaitWhileResistanceAbove( 
  resistance As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

resistance 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the boundary resistance value in ohms. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes below **resistance**. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. If the button is pressed, on Versatile is 0 Ω. If the button is released, on Versatile is more than 2 KΩ. 

```visualbasic
V8.StartResistanceMeasurement() 
// wait while the button is released 
V8.WaitWhileResistanceAbove(1000)
```

The command waits while the resistance is above 1 KΩ. 

# WaitWhileResistanceBelow

The function waits while the measured value lies below **resistance** and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileResistanceBelow( 
  resistance As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

resistance 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the boundary resistance value in ohms. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes above resistance. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. If the button is pressed, on Versatile is 0 Ω. If the button is released, on Versatile is more than 2 KΩ. 

```visualbasic
V8.StartResistanceMeasurement() 
// wait while the button is pressed 
V8.WaitWhileResistanceBelow(1000)
```

The command waits while the resistance is below 1 KΩ. 

# WaitWhileResistanceInRange

The function waits while the measured value lies within **resistance1** and **resistance2** levels and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileResistanceInRange( 
  resistance1 As Double, 
  resistance2 As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

resistance1 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the first resistance value in ohms. 

resistance2 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the second resistance value in ohms. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes outside range resistance1 to resistance2. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. If the button is pressed, on Versatile is 0 Ω. If the button is released, on Versatile is more than 2 KΩ. 

```visualbasic
V8.StartResistanceMeasurement() 
// wait while the button is pressed 
V8.WaitWhileResistanceInRange(0, 1000)
```

The command waits while the resistance is below 1 KΩ. 

#### Example 

A button with potential free contacts is connected to V8. If the button is pressed, on Versatile is 0 Ω. If the button is released, on Versatile is more than 2 KΩ. 

```visualbasic
V8.StartResistanceMeasurement() 

// wait while the button is pressed 
V8.WaitWhileResistanceInRange(0, 1000) 
DebugPrint("Button is released now.") 

// wait while the button is pressed until 10 seconds elapsed 
If V8.WaitWhileResistanceInRange(0, 1000, :10) Then 
  DebugPrint("Button was released within 10 seconds.") 
Else 
  DebugPrint("Button was not released within 10 seconds.") 
End If
```

It prints to the debug window when the button is released "*Button is released now.*". If the button was released within 10 seconds, it prints to the debug window „Button* was released within 10 seconds.*". If the button was not released within 10 seconds, it prints to the debug window after 10 seconds "*Button was not released within 10 seconds.*". 

# WaitWhileVoltageAbove

The function waits while the measured value lies above **voltage** and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileVoltageAbove( 
  voltage As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

voltage 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the boundary voltage value in volts. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes below **voltage**. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. The pullup is ON. If the button is pressed, on Versatile is 0 volts. If the button is released, on Versatile is approximately 4.4 V. 

```visualbasic
V8.PullupOn() 
// wait while the button is released 
V8.WaitWhileVoltageAbove(2)
```

The command waits while the voltage level is above 2 V. 

# WaitWhileVoltageBelow

The function waits while the measured value lies below **voltage** and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileVoltageBelow( 
  voltage As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

voltage 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the boundary voltage value in volts. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes above **voltage**. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. The pullup is ON. If the button is pressed, on Versatile is 0 volts. If the button is released, on Versatile is approximately 4.4 V. 

```visualbasic
V8.PullupOn() 
// wait while the button is pressed 
V8.WaitWhileVoltageBelow(2)
```

The command waits while the voltage level is below 2 V. 

# WaitWhileVoltageInRange

The function waits while the measured value lies within **voltage1** and **voltage2** levels and until the **timeout** elapsed. 

#### Syntax 

```visualbasic
Function WaitWhileVoltageInRange( 
  voltage1 As Double, 
  voltage2 As Double, 
  Optional timeout As Time := _TIME_INFINITE) 
As Boolean
```

#### Parameters 

voltage1 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the first voltage value in volts. 

voltage2 

<u>[Double](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> It is the second voltage value in volts. 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to _TIME_INFINITE. It is time to wait. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the measured value goes outside the range voltage1 to voltage2. It is False when the time elapsed or if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number. 

#### Example 

A button with potential free contacts is connected to V8. The pullup is ON. If the button is pressed, on Versatile is 0 volts. If the button is released, on Versatile is approximately 4.4 V. 

```visualbasic
V8.PullupOn() 
// wait while the button is released 
V8.WaitWhileVoltageInRange(2, 5)
```

The command waits while the voltage level 4.4 V is within 2 V and 5 V. 

#### Example 

A button with potential free contacts is connected to V8. The pullup is ON. If the button is pressed, on Versatile is 0 volts. If the button is released, on Versatile is approximately 4.4 V. 

```visualbasic
V8.PullupOn() 

// wait while the button is released 
V8.WaitWhileVoltageInRange(2, 5) 
DebugPrint("Button is pressed now.") 

// wait while the button is pressed until 10 seconds elapsed 
If V8.WaitWhileVoltageInRange(0, 2, :10.0) Then 
  DebugPrint("Button was released.") 
Else 
  DebugPrint("Button was not released within 10 seconds.") 
End If
```

It prints to the debug window when the button is pressed "*Button is pressed now.*". If the button is released within 10 seconds, it prints to the debug window "*Button was released.*". If the button is not released within 10 seconds, it prints to the debug window after 10 seconds "*Button was not released within 10 *seconds*.*". 

# Structure _VersatileOutputState

This structure is predefined in the firmware of all units, which supports versatile output. 

#### Syntax 

```visualbasic
Structure _VersatileOutputState 
  Var Pullup As _VersatileOutputControl, 
  Var Pulldown As _VersatileOutputControl 
  Var Close As _VersatileOutputControl 
End Structure
```

# Enum _VersatileOutputControl

This enum is predefined in the firmware of all units, which supports versatile output. 

#### Syntax 

```visualbasic
Enum _VersatileOutputControl 
  NoChange := -1, 
  On := 1, 
  Off := 0, 
End Enum
```

# Enum _DigitalThreshold

This enum is predefined in the firmware of all units, which supports digital signal measurement. 

#### Syntax 

```visualbasic
Enum _DigitalThreshold 
  V_1_5 := 1, 
  V_6
End Enum
```

# **Enum _ResistanceRange**

This enum is predefined in the firmware of all units, which supports resistance measurement. 

#### Syntax 

```visualbasic
Enum _ResistanceRange 
  Auto := 0, 
  R_2K, 
  R_20K, 
  R_200K 
End Enum
```

# Enum _VoltageRange

This enum is predefined in the firmware of all units, which supports voltage measurement. 

#### Syntax 

```visualbasic
Enum _VoltageRange 
  Auto := 0, 
  V_2_5, 
  V_10 
End Enum
```