Public up, down, lleft, right As Boolean 'to keep track of which buttons are already pressed
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Form_Load()
cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SEVER=localhost;DATABASE=rccontrol;UID=root"
cn.CursorLocation = adUseClient
cn.Open
MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.Settings = "9600,N,8,1"
MSComm1.DTREnable = False
MSComm1.CommPort = 1
MSComm1.PortOpen = True
If MSComm1.PortOpen = False Then
'MsgBox "COM " + CStr(MSComm1.CommPort) + " not open"
End If
End Sub
Private Sub MSComm1_OnComm()
Dim Data As String
If MSComm1.CommEvent = comEvReceive Then
Data = MSComm1.Input
End If
End Sub
Private Sub Timer1_Timer()
rs.Open "SELECT * FROM presskey WHERE 1", cn, adOpenStatic, adLockOptimistic
Label6.Caption = rs(0).Value
rs.Close
End Sub
use a .net vb, it has inbuilt components for serial port communication.
Why don't you try VB.NET rather than VB, with web services to control your hardware directly from the web
Is this your specific requirements? "web -> vb ->hardware"
Private Sub Btn_AvailPorts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_AvailPorts.Click
ports = SerialPort1.PortName()
ComboBox1.Items.Add(ports)
End Sub
'setting the selected port
Private Sub Btn_Setport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Setport.Click
Dim port As String
port = ComboBox1.SelectedText()
MsgBox("Port is set")
MsgBox("Port :" & SerialPort1.PortName)
End Sub
Private Sub Btn_setcam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_setcam.Click
If SerialPort1.IsOpen Then
SerialPort1.Write(cam)
SerialPort1.Close()
end sub
If Not rs.EOF Then rs.MoveFirst
Do While Not rs.EOF
MSComm1.Output rs(0).Value 'rs!Name
rs.MoveNext
Loop
Check this logic
Code:If Not rs.EOF Then rs.MoveFirst Do While Not rs.EOF MSComm1.Output rs(0).Value 'rs!Name rs.MoveNext Loop
Hi bassa, i tried the code that you give me..but it still not working..
Any errors that you have observed?. Does it send the date via com1 when you execute "Form_KeyDown", Form_KeyUp" events?
Can you see the data in the label6 when you execute this line "Label6.Caption = rs(0).Value"?
There is no error but it's not working..
for label 6, when i press any key in the web site..it show the ascii value in the label 6.
that is it..it like not passing the value to to form_keydown and form keyup events..
First check your serial sending routine by giving known value (ex MSComm1.Output "sk8ter87")
What are the ascii value in the label 6?
Check you form key preview property as true in order to activate form key events (as I remember)
u can check the serial sending part with hyperterminal program.send the values to serial port by manually typing the codes in hyperterminal and check whether the port and hardware is working.
If you can browse the webpage and store the data into the MySQL then that is work fine.
Just check whether the data is updated correctly then hardware (insert some debug messages)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?