New Arduino:Confused with some concepts
hi,
i student , part of subject have build a4wd1 rover(obstacle detection) lynxmotion/robotshop.
used college provide kit sabertooth 2x10 r/c regenerative dual channel motor controller (de-06)
and bot board ii.
had test code autonomous operation , obstacle detection using gp2d12 sensors.
that kit got damaged because of power surge , bought new one.
but new 1 came botboarduino controller , else same.i new arduino , have convert same test program in basic arduino executable language(c/c++)
i searched online , in of robot projects have connections servo controller arduino board , use servo pin in program.
but sabertooth motor controller 2 outputs goes contoller.
i confused , new arduino coding.
can change basic code arduino code.
'connections
'pin 16 jumper battery (vs)
'pin 17 left gp2d12 sensor (right facing sensor)
'pin 18 right gp2d12 sensor (left facing sensor)
'pin 19 rear 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 1500 result in forward direction.
; numbers higher 1500 result in reverse direction.
lspeed = (lspeed - 10) min maxspeed ;accelerates motors
rspeed = (rspeed - 10) min maxspeed
lspeed = (lspeed + ir_left) max minspeed ;when detected, decelerates opposite side
rspeed = (rspeed + ir_right) max minspeed
if (ir_rear > 15) then
lspeed = (lspeed - ir_rear) min maxspeed ;if detected behind robot, accelerates both sides
rspeed = (rspeed - ir_rear) min maxspeed
endif
; send out servo pulses
pulsout 0,(lspeed*2) ; left sabertooth channel.
pulsout 1,(rspeed*2) ; right sabertooth channel.
pause 20
goto main
sensor_check
for temp = 0 9
adin 17, filter(temp)
next
ir_right = 0
for temp = 0 9
ir_right = ir_right + filter(temp)
next
ir_right = ir_right / 85
for temp = 0 9
adin 18, filter(temp)
next
ir_left = 0
for temp = 0 9
ir_left = ir_left + filter(temp)
next
ir_left = ir_left / 85
for temp = 0 9
adin 19, filter(temp)
next
ir_rear = 0
for temp = 0 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
i student , part of subject have build a4wd1 rover(obstacle detection) lynxmotion/robotshop.
used college provide kit sabertooth 2x10 r/c regenerative dual channel motor controller (de-06)
and bot board ii.
had test code autonomous operation , obstacle detection using gp2d12 sensors.
that kit got damaged because of power surge , bought new one.
but new 1 came botboarduino controller , else same.i new arduino , have convert same test program in basic arduino executable language(c/c++)
i searched online , in of robot projects have connections servo controller arduino board , use servo pin in program.
but sabertooth motor controller 2 outputs goes contoller.
i confused , new arduino coding.
can change basic code arduino code.
'connections
'pin 16 jumper battery (vs)
'pin 17 left gp2d12 sensor (right facing sensor)
'pin 18 right gp2d12 sensor (left facing sensor)
'pin 19 rear 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 1500 result in forward direction.
; numbers higher 1500 result in reverse direction.
lspeed = (lspeed - 10) min maxspeed ;accelerates motors
rspeed = (rspeed - 10) min maxspeed
lspeed = (lspeed + ir_left) max minspeed ;when detected, decelerates opposite side
rspeed = (rspeed + ir_right) max minspeed
if (ir_rear > 15) then
lspeed = (lspeed - ir_rear) min maxspeed ;if detected behind robot, accelerates both sides
rspeed = (rspeed - ir_rear) min maxspeed
endif
; send out servo pulses
pulsout 0,(lspeed*2) ; left sabertooth channel.
pulsout 1,(rspeed*2) ; right sabertooth channel.
pause 20
goto main
sensor_check
for temp = 0 9
adin 17, filter(temp)
next
ir_right = 0
for temp = 0 9
ir_right = ir_right + filter(temp)
next
ir_right = ir_right / 85
for temp = 0 9
adin 18, filter(temp)
next
ir_left = 0
for temp = 0 9
ir_left = ir_left + filter(temp)
next
ir_left = ir_left / 85
for temp = 0 9
adin 19, filter(temp)
next
ir_rear = 0
for temp = 0 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
you know might want microcontroller made parallax called basic stamp. mean, know arduino forum, project sounds small part of course, unless intending on learning c, c++ , arduino based hardware, why not board runs basic?
on other hand, if want learn arduino, start out few of examples in ide. after you've been @ week or so, dive in converting program - it's pretty simple program, , conversion one-to-one. make great learning experience!
on third hand, if want you, put ad on gigs , collaborations forum. in ad, how willing pay.
on other hand, if want learn arduino, start out few of examples in ide. after you've been @ week or so, dive in converting program - it's pretty simple program, , conversion one-to-one. make great learning experience!
on third hand, if want you, put ad on gigs , collaborations forum. in ad, how willing pay.
Arduino Forum > Using Arduino > Programming Questions > New Arduino:Confused with some concepts
arduino
Comments
Post a Comment