BStamp problem Code or electric
yceman_cristi
Posts: 5
Hy, I have a little problem and i don't see the solution. I have a normal Boe Bot with a BStamp 2px. The problem is the following: i run a normal code to move the engines front, back, clockwise and counter clockwise. For each movement i have a simple message. while operating the code on the BStamp it runs with no problem, once i start the engines it goes into an infinite loop and executes only the first part, the second i close the engines the programs continues normal. Sorry for the code the attachment manager had an error. Please help me solve the problem. Thanks
Program
' {$STAMP BS2px}
' {$PBASIC 2.5}
i VAR Word
FOR i=1 TO 120
PULSOUT 15,850
PULSOUT 14,850
PAUSE 20
DEBUG "a"
NEXT
FOR i=1 TO 124
PULSOUT 15,650
PULSOUT 14,650
PAUSE 20
DEBUG "b"
NEXT
FOR i=1 TO 122
PULSOUT 14,650
PULSOUT 15,850
PAUSE 20
DEBUG "c"
NEXT
FOR i=1 TO 122
PULSOUT 15,650
PULSOUT 14,850
PAUSE 20
DEBUG "d"
NEXT
end
response from debug: the program should drive the robot with approximation 3 sec in each movement, when i shut down the engines it continues with b
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Program
' {$STAMP BS2px}
' {$PBASIC 2.5}
i VAR Word
FOR i=1 TO 120
PULSOUT 15,850
PULSOUT 14,850
PAUSE 20
DEBUG "a"
NEXT
FOR i=1 TO 124
PULSOUT 15,650
PULSOUT 14,650
PAUSE 20
DEBUG "b"
NEXT
FOR i=1 TO 122
PULSOUT 14,650
PULSOUT 15,850
PAUSE 20
DEBUG "c"
NEXT
FOR i=1 TO 122
PULSOUT 15,650
PULSOUT 14,850
PAUSE 20
DEBUG "d"
NEXT
end
response from debug: the program should drive the robot with approximation 3 sec in each movement, when i shut down the engines it continues with b
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Comments
DEBUG "Starting..."
Sometimes when using servo-motors with a BS2, you 'brown-out' reset the BS2. If you have the above 'debug' statement, you'll see the brown-out reset occurring.
That's not completely true. You have two problems
1) The PULSOUT constants (850 and 650) need to be changed when you use a BS2px. On a BS2, they cause the PULSOUT to produce a pulse of 1700us and 1300us respectively. They would need to be changed to 2125 and 1625 respectively for a BS2px to produce the same pulses.
2) You are probably powering the servos from Vdd (the regulated +5V supply). Servos when they're first starting to move or when they're under mechanical load can draw a lot of current, as much as 1 Ampere. You're starting two servos at the same time. That could easily require more current than the regulator can supply and maybe more current than the battery can supply. The Stamp's supply voltage drops below about 4.3V and it automatically resets. You need to power the servos from the unregulated input supply and that supply voltage has to be in the range 6-7.5V, higher and the servo motors can be damaged.
Post Edited (Mike Green) : 11/5/2009 6:24:01 PM GMT