EDN Admin
Well-known member
as i learn VB 2010 express, i want to try some serial communication and i found this code for VB6..but i have no idea how to make it work in VB2010, is there anyone can help me?
<pre>Private Sub Form_Load()
With MSComm1
non aktifkan dulu serial port
If .PortOpen Then .PortOpen = False
set serial port yang ingin digunakan
.CommPort = 3
set baud rate,parity,databits,stopbits
.Settings = "9600,N,8,1"
set DTR and RTS
.DTREnable = True
.RTSEnable = True
aktifkan event oncomm event
.RThreshold = 1
non aktifkan event oncomm
.SThreshold = 0
aktifkan serial port
.PortOpen = True
End With MSComm1
tampilkan tanda derajat
Label2.Caption = Chr(176) + "C"
End Sub
Private Sub MSComm1_OnComm()
Dim strInput As String
With MSComm1
test event data masuk
Select Case .CommEvent
Case comEvReceive
tampilkan data dari Arduino
strInput = .Input
Label1.Caption = Asc(Mid(strInput, 1, 1))
End Select
End With MSComm1
End Sub[/code]
the program was written in by Indonesian people.. but i think we can ignore it..
View the full article
<pre>Private Sub Form_Load()
With MSComm1
non aktifkan dulu serial port
If .PortOpen Then .PortOpen = False
set serial port yang ingin digunakan
.CommPort = 3
set baud rate,parity,databits,stopbits
.Settings = "9600,N,8,1"
set DTR and RTS
.DTREnable = True
.RTSEnable = True
aktifkan event oncomm event
.RThreshold = 1
non aktifkan event oncomm
.SThreshold = 0
aktifkan serial port
.PortOpen = True
End With MSComm1
tampilkan tanda derajat
Label2.Caption = Chr(176) + "C"
End Sub
Private Sub MSComm1_OnComm()
Dim strInput As String
With MSComm1
test event data masuk
Select Case .CommEvent
Case comEvReceive
tampilkan data dari Arduino
strInput = .Input
Label1.Caption = Asc(Mid(strInput, 1, 1))
End Select
End With MSComm1
End Sub[/code]
the program was written in by Indonesian people.. but i think we can ignore it..
View the full article