Visual Basic – Serial communication
With this script you can send data to a serial port: Needed: Listbox First in the FORM LOAD section load the connected comports to the listbox:
1 2 3 4 5 6 7 |
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Haal COM Poorten op For Each sp As String In My.Computer.Ports.SerialPortNames ListBox1.Items.Add(sp) ListBox1.SelectedIndex = 0 'selecteer altijd een optie (de eerste) Next End Sub |
Create a function for easy serial comport writing (using the comport selected in …