-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathForm1.vb
29 lines (29 loc) · 1019 Bytes
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim array As Byte() = New Byte(3) {}
array = New Byte() {254, 4, 114, 140}
Dim array2 As Byte() = New Byte(4) {}
array2 = New Byte() {114, 5, 0, 240, 153}
If Not SerialPort1.IsOpen Then
SerialPort1.Open()
End If
SerialPort1.BaudRate = 10400
SerialPort1.BreakState = False
Thread.Sleep(100)
SerialPort1.BreakState = True
Thread.Sleep(70)
SerialPort1.BreakState = False
Thread.Sleep(5)
Thread.Sleep(145)
SerialPort1.Write(array, 0, array.Length)
Thread.Sleep(30)
SerialPort1.Write(array2, 0, array2.Length)
Thread.Sleep(30)
SerialPort1.DiscardOutBuffer()
SerialPort1.Close()
Thread.Sleep(1000)
End Sub
End Class