I am trying to get my Brat back up and working after I updated which servos were hooked up to which pin to help another member debug his brat. After I completed this my brats walking sequences were not working well at all and I think I may have one or more servos connected to the wrong pins. So I thought I would use my Brat Sequencing code that communicates with the PC running a VB app to control each servo to verify that right joint was moving.
Well after having the Brat enter the appropriate mode (hitting Record button on the Remote), I tried having the VB app send out a TRY STEP command, which I have programmed a value of -1 for the number of steps to download. The brat displayed “Sequence Loaded” on my LCD which normally implies that I was saving a new sequence instead of trying to run one step of a sequence. I changed my code on the brat to display on the LCD the number of steps that it was instructed to download and when I hit the try button my display software shows the value of 2 for the number of steps.
I am not sure yet if this is a VB/Vista problem or a problem with the BAP beta software properly handling the SDEC…
The Basic Code on the PC looks like:
[code] Private Sub Try1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Try1.Click
’ Send strings to a serial port.
Dim si As SEQ_ITEM
Using com1 As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort(ComLB.Items(ComLB.SelectedIndex), BaudCB.Items(BaudCB.SelectedIndex))
com1.WriteLine(-1)
si = SEQS.Items.Item(SEQS.SelectedIndex)
com1.WriteLine(si.ToString)
End Using
End Sub
[/code]
The code to receive it on the brat:
[code]
…
GHCCnt var sword
GHCVals var sbyte[6]
GHCTime var sword
GetCommandsFromHost
gosub LCD_ClearAndReturn
LCD_String = “Host Command”, 0
gosub LCD_Print[1,0]
pause 250
command=0xFF
GCHMain
if command<>0xFF then
if command = 29 then ; until we get another record command
gosub LCD_ClearAndReturn
sound 9,[50\3960]
return
elseif command = 25 ; Got a pause button. try to display what is recorded…
gosub PlayRecordedSeq[0]
elseif command = 26 ; Got a play button. try to play what is recorded…
gosub PlayRecordedSeq[1]
endif
endif
Command=0xFF
;
; now lets try to get some serial input from our Host PC
;
serin s_in, i2400, 250, GCHTimeout, [sdec GHCCnt]
; Ok we got a count. If it is -1 then it is a do immediate!
gosub LCDConvertNumToString[GHCCnt]
gosub LCD_Print[1,0]
if GHCCnt = -1 then
; now lets try to get some serial input from our Host PC
serin s_in, i2400, 5000, GCHTimeout, [sdec GHCVals(0), sdec GHCVals(1),sdec GHCVals(2),sdec GHCVals(3),sdec GHCVals(4),sdec GHCVals(5),sdec GHCTime]
; We got a command!
gosub movement[tofloat GHCVals(0), tofloat GHCVals(1), tofloat GHCVals(2), tofloat GHCVals(3), tofloat GHCVals(4), tofloat GHCVals(5), tofloat GHCTime]
elseif GHCCnt = -42
; The pc has asked us to download the loaded sequence back to them.
…[/code]
It appears like either the PC is not generating the value correctly or the SDEC modifier did not work.
I will try to debug more later, but I got to run…
Suggestions?