newbie, help with gripper and remote
Hi,
Need some help with the boe-bot gripper and remote
Just started with basic stamp, and have had a heck of a time finding info on how to program.
I have gotten the remote to work the boe-bot tank, but can not get it to work the gripper right.· The gripper does not close tight, nor does it stay closed. Using the RF Digital 418 Mhz Keyfob reciever 5 button) and everything else is standard from Parallax.
Any suggestions would be great
Here is what I've got so far.....
Thanks,
' {$STAMP BS2}
' {$PBASIC 2.5}
pulsecount VAR· Byte
start:
IF IN5 = 1 THEN gripper
IF IN4 = 1 THEN forward
IF IN2 = 1 THEN back
IF IN1 = 1 THEN left
IF IN3 = 1 THEN right
GOTO start
· forward:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 650
· PULSOUT 12, 850
· PAUSE 0
· NEXT
· RETURN
· back:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 850
· PULSOUT 12, 650
· PAUSE 0
· NEXT
· RETURN
· left:
· FOR· pulsecount = 1 TO 30
· PULSOUT 13, 650
· PULSOUT 12, 650
· PAUSE 0
· NEXT
· RETURN
· right:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 850
· PULSOUT 12, 850
· PAUSE 0
· NEXT
· RETURN
· gripper:
· IF IN4 = 1 THEN close
· IF IN2 = 1 THEN open
· close:
· FOR pulsecount = 1 TO 30
· PULSOUT 12, 750
· PULSOUT 13, 750
· PULSOUT 14, 1000
· PAUSE 0
· NEXT
· RETURN
·
open:
· FOR pulsecount = 1 TO 30
· PULSOUT 12, 750
· PULSOUT 13, 750
· PULSOUT 14, 500
· PAUSE 0
· NEXT
· RETURN
Oh, and why do I have to have a pulsecount? I just want it to do the right action for however long I press the button, have to do this for a projects class but they taught us nothing about basic stamp.· Trying the best I can , but the downloaded manual is not the most exciting nor understandable read.
thanks again!
Post Edited By Moderator (Chris Savage (Parallax)) : 4/27/2006 7:44:47 PM GMT
Need some help with the boe-bot gripper and remote
Just started with basic stamp, and have had a heck of a time finding info on how to program.
I have gotten the remote to work the boe-bot tank, but can not get it to work the gripper right.· The gripper does not close tight, nor does it stay closed. Using the RF Digital 418 Mhz Keyfob reciever 5 button) and everything else is standard from Parallax.
Any suggestions would be great
Here is what I've got so far.....
Thanks,
' {$STAMP BS2}
' {$PBASIC 2.5}
pulsecount VAR· Byte
start:
IF IN5 = 1 THEN gripper
IF IN4 = 1 THEN forward
IF IN2 = 1 THEN back
IF IN1 = 1 THEN left
IF IN3 = 1 THEN right
GOTO start
· forward:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 650
· PULSOUT 12, 850
· PAUSE 0
· NEXT
· RETURN
· back:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 850
· PULSOUT 12, 650
· PAUSE 0
· NEXT
· RETURN
· left:
· FOR· pulsecount = 1 TO 30
· PULSOUT 13, 650
· PULSOUT 12, 650
· PAUSE 0
· NEXT
· RETURN
· right:
· FOR pulsecount = 1 TO 30
· PULSOUT 13, 850
· PULSOUT 12, 850
· PAUSE 0
· NEXT
· RETURN
· gripper:
· IF IN4 = 1 THEN close
· IF IN2 = 1 THEN open
· close:
· FOR pulsecount = 1 TO 30
· PULSOUT 12, 750
· PULSOUT 13, 750
· PULSOUT 14, 1000
· PAUSE 0
· NEXT
· RETURN
·
open:
· FOR pulsecount = 1 TO 30
· PULSOUT 12, 750
· PULSOUT 13, 750
· PULSOUT 14, 500
· PAUSE 0
· NEXT
· RETURN
Oh, and why do I have to have a pulsecount? I just want it to do the right action for however long I press the button, have to do this for a projects class but they taught us nothing about basic stamp.· Trying the best I can , but the downloaded manual is not the most exciting nor understandable read.
thanks again!
Post Edited By Moderator (Chris Savage (Parallax)) : 4/27/2006 7:44:47 PM GMT
Comments
One thing I noticed in your code is that you are using subroutines but you are entering them with direct gotos. This will mess things up. You need to use Gosubs.
Also, I noticed that each subroutine has a pause of "0". This won't serve much purpose. There needs to be a delay of 10-15 mSec between pulses to the servos.
The pulsecount is used because the time it takes for the servo to move is much greater than time the program runs. You have to keep sending pulses to the servo until it gets where it's going.
You need to take a closer look at the "gripper" label area. Consider if the input is not 2 or 4 and what happens then. Servos do not hold their position when they are not getting pulses. Your program is using the servo's inherent inertia to hold position. If you want the gripper to maintain pressure, you will have to keep sending pulses.
As far as the comments about the manual. You appearantly haven't read that many software manuals. They are all boring as sin. None are Grisham novels. The Basic Stamp manual is one of the best documented manuals that I have used. It is also backed up with mountains of info on the Parallax website. It looks like your solution is to just add a bit of time and experience because you are on the right track.
Lee
So you'll need a 'refresh' subroutine to re-send the currently desired servo position out to each servo. And you'll need to call that routine at least once every 50 mSec, and preferably once every 20 mSec.