Serial Server and Serial Client

This example is meant to be used when wiring up the serial ports of two Text Controllers.

Text Controller Setup

Drag in two Text Controllers and name one Serial Server and the other one Serial Client. In the Serial Server Text Controller, add a Virtual Serial Port Output and two knobs. Both knobs will have these control types:

Name the first knob RxData and the second knob TxData. Next, in the Serial Client Text Controller, add a Serial Port Input, toggle button, trigger button, and a knob. Name the toggle button AutoSend, the trigger button Send, and the knob Count. The Count knob will have the same control types as the knobs in the Serial Server Text Controller. Next, wire up the serial pins between the two Text Controllers (see screenshot). Finally, copy the code below to its respective Text Controller.

 

 

Using the Example

The purpose of this example is to send an integer from the Serial Client to the Serial Server, have the Serial Server increment the integer, and send it back to the Serial Client via a TCP connection to the loopback address. The process then starts over. The integer will be incremented to 10, and then reset back to 1. Use the Send button to send the value or toggle the AutoSend button to send the values automatically on a timer.