我尝试将此邮件发送到SData(0) = 85
SData(1) = 170
SData(2) = 36
SData(3) = 1
SData(4) = 2
SData(5) = 0
SData(6) = 1
SData(7) = 0
SData(8) = 0
SData(9) = 0
SData(10) = 0
SData(11) = 0
SData(12) = 0
SData(13) = 0
SData(14) = 0
SData(15) = 0
SData(16) = 0
SData(17) = 0
SData(18) = 0
SData(19) = 0
SData(20) = 0
SData(21) = 0
SData(22) = 39
SData(23) = 1
SerialPort1.Open()
For i = 0 To 23
SerialPort1.Write(Chr(SData(i)))
Next
SerialPort1.Close()
来命令设备' LED点亮。
SerialPort
我没有收到设备或其他任何内容的回复。然后我注意到模块冻结了2秒,我认为它是循环。
我想我需要知道MSComm1.Output = Chr(SData(i))
从开放到结束的步骤。
这里有什么工作:Sub BTS()
Dim RowID As Integer
Dim SiteID As String
Dim objFindSiteID As Range
Dim objControllerData As Workbook
Dim WS As Worksheet
Dim lastRow As Long
Dim v As Range
SiteID = ThisWorkbook.Sheets("Sheet1").Range("A3").Value
If ThisWorkbook.Sheets("Sheet1").Range("B3").Value = "someValue" Then
Set objControllerData = Workbooks.Open("C:\Users\bla\bababa\bla.xls", True, True)
End If
For Each WS In objControllerData.Worksheets
lastRow = WS.Cells(WS.Rows.Count, "B").End(xlUp).Row
For I = 1 To lastRow
v = WS.Range("D" & I).Value
If v = SiteID Then
RowID = v.Row
MsgBox lastRow
MsgBox RowID
End If
Next I
Next WS
End Sub