---
title: "Commands with a parameter"
canonical: "https://docs.cuesystem.com/space/CVCBP/766607376/Commands%20with%20a%20parameter"
format: markdown
---
> Macro (prevnextnav-macro)

---

If you would prefer to have the command for selecting input with input number as a parameter, then next function could be added to the driver source code.

This can be advantageous if the device has many inputs, or for absolute volume control, etc., and where entering a special command for each option would lead to a large and confusing number of commands.


```visualbasic
Global Function SetInput(input As Long)

End Function
```

For the ByteString construction, the command FormatByteString is used.

```visualbasic
Global Function SetInput(input As Long)
    Var Tmp As ByteString[10]
    FormatByteString(Tmp,&S"{n}!",input)
    
    
End Function
```

This command creates the ByteString contents of the variable in the first parameter according the formating specification in the second parameter. This formating ByteString is to be constructed using Formating rules with help of third and other parameters of the command.

See [CVC Help for details concerning FormatByteString](https://docs.cuesystem.com/space/CVCHELP/512328011/Format+ByteString+specification).

We create a new SetInput function, where the input number will be a parameter of this function.

![image](media://0ce9bf8a-1fce-4ffd-b1af-ce829a7d84de)

![image](media://8cb2a7ae-e9c1-473a-9f89-57b06494f56a)

We will need a bytestring variable Tmp, in which the constructed string will be placed. The length of this string will be 3 bytes, it is enough for our purposes. Then Format Byte string command must be added. The input parameter of the SetInput function is used here as a formatting parameter.

![image](media://8bf42563-2e97-444b-befc-4c52b8babb2e)

To see the actual ByteString value which was sent to the serial Channel the command DebugPrint can be added and finally add the Serial connector dot Send Tmp command to send the bytestring to the serial port.

![image](media://a822dfd6-f87c-4c99-8d03-e21d6db9cdac)

You can test the right syntax using the Build button. The result is displayed in the Output window.

![image](media://fbf2d119-827a-44b0-a11f-1664fded2d46)

To test the SetInput function, we have to modify the PushButton processes to apply this new function  with paramerters 1, 2, 3 and 4 for particular buttons. Use the following process:

![image](media://949035ac-6770-45c8-89f8-13325eba58b0)

![image](media://6d4a9970-359f-48a5-b386-7b5b4bd85548)

![image](media://bc61c180-cf3f-441b-bf28-06d7408bd003)

![image](media://2ae5c4e4-400c-4056-8aa4-fe8d8fd4c73e)

Now we can test again with hardware

![image](media://67e94345-0cac-43aa-a45c-774ca295d9cf)

![image](media://558e39a2-c8b4-46df-b4c6-e5f82384aabc)

![image](media://bcf2e7f4-0f68-446b-a477-e75f21064b20)

In the CVC Output window we can observe the actual ByteStrings which were sent by a serial channel.

Pressing the PushButtons on the simulated touch panel you should see the Switcher reaction.

![image](media://ae6b99bd-de4c-4464-bded-c32ef06246a1)

![image](media://37da2212-9acc-4157-a769-4b1649c95d40)

![image](media://6f427580-c317-4101-8719-2b968475b8f6)

![image](media://80090df6-b70e-48d4-80b5-d5543e10e538)

The driver created in this way can be used as one way driver with ports capable to work in one way serial communication:

- IR-Serial ports
- Versatile Ports
- Universal Ports

When all functions are checked and the driver is finished, do not forget to export the driver for next use and back-up it on the CUE cloud. 

![image](media://778a3cf2-63b4-4d05-afdc-1075c2439f5b)

![image](media://bb9ffbd2-8d0c-4162-a874-c62d92a3624c)

At the end also save the project.

![image](media://aa649b52-8792-45b8-a1f0-86c8d66ba4fa)

---

> Macro (prevnextnav-macro)