06.02.2020

Vba Serial Communications

Vba Serial Communications
  1. Vba Serial Port Communications

Vba Serial Port Communications

Code:Private Sub CommandButton1Click' Buffer to hold input stringDim Instring As String' Use COM13MSComm1.CommPort = 13' 9600 baud, no parity, 8 data, and 1 stop bit.MSComm1.Settings = '9600,N,8,1' Tell the control to read entire buffer when Input' is used.MSComm1.InputLen = 0' Open the port.MSComm1.PortOpen = True' Send the data to the portdata = TextBox1.Text ' The brightness required, 0-255Debug.Print 'Data=' & data' Send the data to the Arduino.MSComm1.Output = data & vbCrLf' Close the PortMSComm1.PortOpen = FalseEnd SubAny thoughts?Moderator edit: code/codetags added. Resident evil code veronica.