I spent all day digging through forums (here and programming sites) and help files and experimenting with code but finally got it working. There is some great posts on VB in these threads but there are some big changes from VB6 to 2005 to 2008 and each version handles the serial port differently. Once I got the port open and write syntax right, I rewrote some VB6 code from cwkoehler and got it working with my BRAT. It’s just a single horizontal scroll bar in a small form. I wanted to keep it as basic as possible so I could see how little is needed to make it work.
So, since I’m not a programmer and spent all day putting this all together and don’t want anyone else to have to dig as much, here’s the simplest I can make the instructions. If anyone has anything to add or change, please reply.
-First, create a new Windows Form project
-Drag a serialport object onto the form
-Click on the serialport object and in the Properties window, change the BaudRate value of SerialPort1 to whatever you use (mine is 115200)
-Drag an HScrollBar object from the toolbar onto the form and resize as you want
-Doubleclick the form and replace everything with the code below
[code]Public Class Form1
Dim scroll1value As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Open()
HScrollBar1.SmallChange = 100 'sets up speed of movement within the form itself
HScrollBar1.LargeChange = 200
HScrollBar1.Minimum = 500 'sets scrollbar minimum equal to lowest Pulse width of SSC-32
HScrollBar1.Maximum = 2500 'sets scrollbar maximum equal to highest Pulse width of SSC-32
HScrollBar1.Value = 1500 'sets HscrollBar1 to center position which corresponds to servo center
scroll1value = HScrollBar1.Value
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
SerialPort1.Write("#0 P" & HScrollBar1.Value & "S750" + Chr(13))
End Sub
End Class
[/code]
Change the #0 in the SerialPort1.Write command to whatever pin your servo is connected to on the SSC-32 that you’d like to test. Mine was the right ankle on the BRAT. Hit F5 to run the program and hopefully it works as well as it did for me!