---
title: "Ir channel (_Ir class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/520585217/Ir%20channel%20(_Ir%20class)"
format: markdown
---
> Macro (toc)

---

# IrSend

The function sends IR data to the IR 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)
```

#### Parameters 

irdata 

_IrData It is the data to be sent. 

repeatuntilstop 

[<u>Boolean</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) 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. 

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

repeatuntilstop 

[<u>Boolean</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text). 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)  It is True on success or False if an error occurs. 

The function [<u>GetLastError</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError) returns the error number. These errors can happen: [<u>600</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#600), [<u>601</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#601), [<u>602</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#602), [<u>603</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#603). 

# Send

The function sends data to the IR 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#ByteString) It is the data to be sent. 

#### Return value 

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

# SetCarrier

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

#### Syntax 

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

#### Parameters 

enable 

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

# SetSerialParameters

The function sets the communication parameters of the IR 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) 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 RS232 mode. |

bitspersecond 

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

databits 

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

parity 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) 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 one half stop bits. |
| _SERIAL_STOPBITS_TWO | 2 | Two stop bits. |

flowcontrol 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) It is the type of 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</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time) It is the delay time between bytes. 

#### Return value 

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

#### Examples 

Channel IR1 is in RS232 mode, 9600 bits per second, 8 data bits, no parity, one stop bit, and no handshake. 

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

Channel IR1 is in RS232 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
IR1.SetSerialParameters( 
  _SERIAL_MODE_RS232, 
  9600, 
  8, 
  _SERIAL_PARITY_NO, 
  _SERIAL_STOPBITS_ONE, 
  _SERIAL_FLOWCONTROL_DELAY, 
  :1)
```

# StopIrSend

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

#### Syntax 

```
Function StopIrSend()
```