\'强制Y2_ON_OFF
Private Sub Command5_Click()
Dim AckStr As String
Dim sendstr As String
If Shape_Y2.FillColor = QBColor(10) Then
sendstr = Chr$(2) + "70205" + Chr$(3) + "01" \'强制Y2_ON
MSComm1.Output = sendstr
AckStr = MSComm1.Input
\'m1 = Asc(AckStr)
If AckStr = Chr(15) Then \'用返回值<>chr(6)来解决初始状态点击无用,
Shape_Y2.FillColor = QBColor(10) \'反向
Else
Shape_Y2.FillColor = QBColor(12) \'反向
End If
Else
sendstr = Chr$(2) + "80205" + Chr$(3) + "02" \'强制Y2_OFF
MSComm1.Output = sendstr
AckStr = MSComm1.Input
If AckStr = Chr(6) Then
Shape_Y2.FillColor = QBColor(10)
Else
Shape_Y2.FillColor = QBColor(12)
End If
End If
End Sub