Sending byte by byte using SerialPort in VB.Net

  • Thread starter Thread starter Eekhay
  • Start date Start date
E

Eekhay

Guest
Hi All,

I have device connect as virtual com port but it seems able to received byte by byte with interval 1 second for each byte.

Is any way to simplify to code below that able to work both Hex and Character?

SerialPort1.Write(New Byte() {&H23}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H44}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H45}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H56}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H54}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H45}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H53}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&H54}, 0, 1)
Thread.Sleep(1000)
SerialPort1.Write(New Byte() {&HD}, 0, 1)
Thread.Sleep(1000)
Thank you.

Continue reading...
 
Back
Top