|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: VB or any other GUI programmers
Quote:
-John |
|
#2
|
||||
|
||||
|
Re: VB or any other GUI programmers
Sure, but I don't know VB. Make sure the start byte is 255 !!!
|
|
#3
|
||||
|
||||
|
Re: VB or any other GUI programmers
Hahaha Yea, well I though you don't know vB I will post the code here anyways, would you be willing to help me out if we can't get it to work in vB because I know you got the one program working before, or could you email me the program is you still have it? I can't seem to find it this way I can play with 3 servos for the time being.
Code:
Public Class Form1
Dim i As Integer
Dim Run As Boolean = False
Dim Mode As String
Dim Initialized As Boolean = False
Dim value0 As Integer
Dim value1 As Integer
Dim value2 As Integer
Dim value3 As Integer
Dim value4 As Integer
Dim value5 As Integer
Dim value6 As Integer
Dim value7 As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LED.Hide()
End Sub
Private Sub RunBut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunBut.Click
If Run = False Then
COMPort.PortName = PortName.Text
COMPort.Open()
RunBut.Text = "Stop"
Timer.Enabled = True
Run = True
Initialized = True
Exit Sub
End If
If Run = True Then
COMPort.Close()
RunBut.Text = "Run"
Timer.Enabled = False
Run = False
Initialized = False
End If
End Sub
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
If Initialized = True Then
If Mode = "Auto" Then
'We are in auto-send mode so send Data
'TO DO: Parse Data and send over COM Port
SendPacket(0, value0)
SendPacket(1, value1)
SendPacket(2, value2)
SendPacket(3, value3)
SendPacket(4, value4)
SendPacket(5, value5)
SendPacket(6, value6)
SendPacket(7, value7)
End If
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Mode = "Auto"
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
Mode = "Man"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Mode = "Man" Then
If Initialized Then
'We are in Manual send mode, send the data
'TO DO: Parse data and send
SendPacket(0, value0)
SendPacket(1, value1)
SendPacket(2, value2)
SendPacket(3, value3)
SendPacket(4, value4)
SendPacket(5, value5)
SendPacket(6, value6)
SendPacket(7, value7)
End If
End If
End Sub
Private Sub Serv1bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv1bar.Scroll
Serv1box.Text = Serv1bar.Value
value0 = Serv1bar.Value
End Sub
Private Sub Serv2bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv2bar.Scroll
Serv2box.Text = Serv2bar.Value
value1 = Serv2bar.Value
End Sub
Private Sub Serv3bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv3bar.Scroll
Serv3box.Text = Serv3bar.Value
value2 = Serv3bar.Value
End Sub
Private Sub Serv4bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv4bar.Scroll
Serv4box.Text = Serv4bar.Value
value3 = Serv4bar.Value
End Sub
Private Sub Serv5bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv5bar.Scroll
Serv5box.Text = Serv5bar.Value
value4 = Serv5bar.Value
End Sub
Private Sub Serv6bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv6bar.Scroll
Serv6box.Text = Serv6bar.Value
value5 = Serv6bar.Value
End Sub
Private Sub Serv7bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv7bar.Scroll
Serv7box.Text = Serv7bar.Value
value6 = Serv7bar.Value
End Sub
Private Sub Serv8bar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv8bar.Scroll
Serv8box.Text = Serv8bar.Value
value7 = Serv8bar.Value
End Sub
Private Sub Serv1box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv1box.TextChanged
Serv1bar.Value = Serv1box.Text
value0 = Serv1box.Text
End Sub
Private Sub Serv2box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv2box.TextChanged
Serv2bar.Value = Serv2box.Text
value1 = Serv2box.Text
End Sub
Private Sub Serv3box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv3box.TextChanged
Serv3bar.Value = Serv3box.Text
value2 = Serv3box.Text
End Sub
Private Sub Serv4box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv4box.TextChanged
Serv4bar.Value = Serv4box.Text
value3 = Serv4box.Text
End Sub
Private Sub Serv5box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv5box.TextChanged
Serv5bar.Value = Serv5box.Text
value4 = Serv5box.Text
End Sub
Private Sub Serv6box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv6box.TextChanged
Serv6bar.Value = Serv6box.Text
value5 = Serv6box.Text
End Sub
Private Sub Serv7box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv7box.TextChanged
Serv7bar.Value = Serv7box.Text
value6 = Serv7box.Text
End Sub
Private Sub Serv8box_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Serv8box.TextChanged
Serv8bar.Value = Serv8box.Text
value7 = Serv8box.Text
End Sub
Private Sub SendPacket(ByVal servo As Integer, ByVal value As Integer)
COMPort.Write(255)
COMPort.Write(servo)
COMPort.Write(value)
For i = 1 To 300
LED.Show()
Next
LED.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
COMPort.Write(255)
COMPort.Write(0)
COMPort.Write(127)
End Sub
End Class
thanks, John |
|
#4
|
||||
|
||||
|
Re: VB or any other GUI programmers
I am having a hard time understanding the VB sintax...
Anyway, I am sending the old program and free serial port monitor that you can use to see any data that is being send over the serial port in the zip file. You might want to use SerialPort instead of COMport Did you ever set the correct BaudRate? Serial Port Monitor -> COMx -> DataView Right Click the Panes to change form HEX to decimal display Last edited by 6600gt : 07-04-2007 at 20:31. |
|
#5
|
||||
|
||||
|
Re: VB or any other GUI programmers
Can you change your program so that I can select a serial port? I don't know if you have the source still, And can you send the source? pretty please?
I am having another problem that I will post about in this thread: http://www.chiefdelphi.com/forums/sh...061#post614061 Last edited by John Gutmann : 07-04-2007 at 23:24. |
|
#6
|
||||
|
||||
|
Re: VB or any other GUI programmers
This has everything. In the release folder you should find the new program.
I had to split up the files cause I can only upload 3mb zips at a time. The data base goes in the original sparksandtabs folder that you will unzip with the sln file. It will automatically find all the ports on your computer and try to open with the first one and you can choose which other ones to use from the drop down thing on the bottom. ALSO, if you dial up modems active on your computer they might cause problems with the serial port use. So disable it in the Device Manager. Oh and I moded it to have the send feature or auto feature you asked for. Good Luck. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Any other robots w/Easy C at Boilermaker? | Chris_Elston | Programming | 7 | 26-03-2006 10:07 |
| Any other NaNoWriMo'ers here? | Alex Pelan | Chit-Chat | 4 | 16-11-2004 10:14 |
| any other team design bumpers? | Alex Cormier | General Forum | 18 | 16-03-2003 15:47 |
| Any other Ukrainians here? other then me | Alex Cormier | Chit-Chat | 3 | 25-02-2003 22:02 |
| Any student programmers going to UCF prog. Comp. | archiver | 2000 | 0 | 23-06-2002 22:56 |