Imports System
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Imports System.ComponentModel
Public Class Automation
Private Sub Automation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RS232.Close()
RS232.PortName = "com11" 'change com port to match your Arduino port
RS232.BaudRate = 9600
RS232.DataBits = 8
RS232.Parity = Parity.None
RS232.StopBits = StopBits.One
RS232.Handshake = Handshake.None
RS232.Encoding = System.Text.Encoding.Default 'very important!
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RS232.Open()
RS232.Write("A")
RS232.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RS232.Open()
RS232.Write("B")
RS232.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
RS232.Open()
RS232.Write("C")
RS232.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
RS232.Open()
RS232.Write("D")
RS232.Close()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
RS232.Open()
RS232.Write("E")
RS232.Close()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
RS232.Open()
RS232.Write("F")
RS232.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
RS232.Open()
RS232.Write("G")
RS232.Close()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
RS232.Open()
RS232.Write("H")
RS232.Close()
End Sub
End Class