Paso 2: Visual Basic
Las importaciones de System.IO
Las importaciones System.IO.Ports
Las importaciones System.Threading
Public Class Form1
_Continue compartido como Boolean
Compartido _serialPort SerialPort
Privada Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) maneja MyBase.Load
Con SerialPort1
. Close()
. PortName = "COM4"
. Velocidad en baudios = 19200
. Paridad = Parity.None
. DataBits = 8
. StopBits = StopBits.One
. DtrEnable = True
. = True
. ReceivedBytesThreshold = 1
. Open()
Terminar con
End Sub
Privada Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) maneja Button1.Click
SerialPort1.Write("A")
End Sub
Privada Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) maneja Button2.Click
SerialPort1.Write("B")
End Sub
Clase final