User manual

interface and coding. Without importing the Encoding Library,
we will, e.g., be unable to evaluate any values exceeding 128,
since we cannot switch the interface to UTF-8 format then. Our
measured result would be wrong then!
001 Dim input_data(10) As Byte
input_data(10)
is used to set up an array that can take up up to
10 bytes. The received bytes from the serial interface will be
filed in this later.
001 Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
In the function
Form1_load()
, present Comports will be found now.
They are listed in the combo box. The
Form1_Load()
-function will
automatically be called first when the program starts similar
to the
Setup()
-function of our Arduino™-program.
001 Private Sub Button_Connect_Click(ByVal sender As System.
Object, ByVal e As System.EventArgs) Handles
Button_Connect.Click
In the function
Button_Connect_Click()
, you will configure and open
the serial interface at the same time. This function is called
when clicking the Connect button.
001 SerialPort1.PortName = ComboBox_Comport.Text
002 SerialPort1.BaudRate = 19200
003 SerialPort1.Encoding = System.Text.Encoding.UTF8
004 SerialPort1.Open()
Here, we specify the Comport, the Baud rate and the Encoding,
and open the interface with
SerialPort1.Open()
, which will then be
ready to transfer and receive.
001 Private Sub Button_Disconnect_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button_Disconnect.Click
The function
Button_Disconnect_Click()
closes the interface again. It