I used the same wiring diagram as this but since I am planning on using the analog inputs for the SSC-32, I wired the Tx and ground from the SSC-32 to an I/O pin(14,Rx) andI/O pin(15,Tx) of the Bot Board. Both are using the same ground from the SSC-32. Make sense?
http://i80.photobucket.com/albums/j176/hounddigitydog/ssc32bb21.gif
I am using 2 inductors as anolog inputs(1,2) to the Bot Board as an out of bounds sensor. We have a wire that is electrically charged and oscillates at 10 Khz. That part of our system works fine. Here is my circuit schematic just in case.
http://i80.photobucket.com/albums/j176/hounddigitydog/untitled.gif
The GPD-12? sensor is also going into an anolog input(VS, beside pin 2) on the Bot Board. It works fine also.
Like before my problem occurs when I try and communicate with SSC-32 that I want it to procede with arm moves. The robot won’t stop. It tries the arm moves but is really jumpy. Here is my code.
[code]
'Connections
'Pin 16 Jumper to battery (VS)
'Pin 17 Left right inductor
'Pin 18 Right Inductor
'Pin 19 GP2D12 Sensor
'Pin 0 Left Sabertooth channel.
'Pin 1 Right Sabertooth channel.
'Pin 12 A Button.
'Pin 13 B Button.
'Pin 14 C Button.
'Pin 9 Speaker.
temp var byte
filter var word(10)
ir_right var word
ir_left var word
ir_rear var word
LSpeed var word
RSpeed var word
minspeed con 1750
maxspeed con 1250
LSpeed = 1500
RSpeed = 1500
low p0
low p1
sound 9, [100\880, 100\988, 100\1046, 100\1175]
main
gosub sensor_check
; Numbers lower than 1500 result in forward direction.
; Numbers higher than 1500 result in reverse direction.
LSpeed = (LSpeed - 10) min maxspeed ;accelerates the motors
RSpeed = (RSpeed - 10) min maxspeed
LSpeed = (LSpeed + (ir_left - 10)) max minspeed ;when something is detected, this decelerates the opposite side
RSpeed = (RSpeed + ir_right) max minspeed
;if (ir_rear > 15) then
;LSpeed = (LSpeed - ir_rear) min maxspeed ;if something is detected behind the robot, accelerates both sides
;RSpeed = (RSpeed - ir_rear) min maxspeed
;endif
; Send out the servo pulses
pulsout 0,(LSpeed2) ; Left Sabertooth channel.
pulsout 1,(RSpeed2) ; Right Sabertooth channel.
pause 20
if (ir_rear > 50) then
LSpeed = 1500
RSpeed = 1500
endif
if LSpeed = 1500 then
gosub arm_move
endif
goto main
sensor_check
for temp = 0 to 9
adin 17, filter(temp)
next
ir_right = 0
for temp = 0 to 9
ir_right = ir_right + filter(temp)
next
ir_right = ir_right / 85
for temp = 0 to 9
adin 18, filter(temp)
next
ir_left = 0
for temp = 0 to 9
ir_left = ir_left + filter(temp)
next
ir_left = ir_left / 85
for temp = 0 to 9
adin 19, filter(temp)
next
ir_rear = 0
for temp = 0 to 9
ir_rear = ir_rear + filter(temp)
next
ir_rear = ir_rear / 85
serout s_out,i38400,"ir_right - ", dec ir_right, " ir_left - ", dec ir_left, " ir_rear - ", dec ir_rear, "LSpeed - ", dec LSpeed, " RSpeed - ", dec RSpeed, 13]
return
arm_move
Steps Bytetable 148, 128, 111, 79, 174, 144, |
148, 128, 111, 79, 174, 144, |
148, 146, 182, 73, 174, 144, |
148, 148, 188, 76, 134, 144, |
148, 146, 145, 58, 134, 144, |
69, 146, 145, 58, 134, 144, |
69, 145, 152, 66, 179, 144, |
153, 164, 166, 58, 179, 144
TimeAndPause Wordtable 1000, 0, |
30, 0, |
990, 0, |
90, 0, |
540, 0, |
1230, 0, |
120, 0, |
1110, 0
JointNB con 6
SSC32 con p14
StepIndex var Word
pause 500
For StepIndex = 0 to 7
serout SSC32,i38400,"#0P", DEC Steps(StepIndex * JointNB) * 10, |
" #1P", DEC Steps(StepIndex * JointNB + 1) * 10, |
" #2P", DEC Steps(StepIndex * JointNB + 2) * 10, |
" #3P", DEC Steps(StepIndex * JointNB + 3) * 10, |
" #4P", DEC Steps(StepIndex * JointNB + 4) * 10, |
" #5P", DEC Steps(StepIndex * JointNB + 5) * 10, |
" T", DEC TimeAndPause(StepIndex * 2), 13]
Pause TimeAndPause(StepIndex * 2) + TimeAndPause(StepIndex * 2 + 1)
next
goto main
[/code][/code]