This next one is to move the eyes right and left, Make sure the vr signal center wire is at pin 7 for this and use your data for the eye left and right movement to make changes to match your data. Look at the notes in the program to determine where you need to change the data. here is the program and the video will follow:
' {$STAMP BS2}
' {$PBASIC 2.5}
' test motor movement and check vr's for proper poition and move eyes rt and lt
Result VAR Word 'Word variable to hold result.
LOW 10 ' set pin 10 low eye right
HIGH 8 ' set pin 8 high eye left to move motor eye left
LOW 8 ' ser pin 8 low eye left to stop motor eye left
Main:
GOSUB checkeyes
IF RESULT =1 OR RESULT =0 THEN GOTO BUG ' if vr has no signal stop program
IF result <= 1100 THEN GOTO EYELEFT ' change left eye min
IF result >= 2300 THEN GOTO eyeright ' change right eye max
GOTO eyeright
GOTO MAIN
BUG:
DEBUG "bug found in VR READINGS = ", DEC RESULT,CR ' if signal loss stop routine
STOP
checkeyes: ' checking the VR location
HIGH 7 'use pin 7 to Discharge the cap circuit
PAUSE 1 'for 1 ms.
RCTIME 7, 1, Result 'Measure RC charge time. convert analog to digital
RETURN
eyeright: ' move right eye to the right
HIGH 10 ' turn motor on
CHECKRT:
DEBUG "eye right mode", DEC result, CR
GOSUB checkeyes
IF Result < 1100 THEN GOTO LINESLOW 'check to see if it at the lower limits change to min
GOTO CHECKRT
eyeleft: 'move eye to the left
HIGH 8 'turn on motor
CHECKLT:
DEBUG "eyeleft mode", DEC result
GOSUB checkeyes
IF Result > 2300 THEN GOTO LinesLow ' if over limit turn off motor change to max
GOTO CHECKLT
LinesLow: ' turn off motor
LOW 8
LOW 10
DEBUG "droped lines low" , CR
GOTO main
here is the video:
Enjoy! GWJax
GWJax, To Hack and make mods on robots is a life style and comes natural and not by choice. If a robot has a screw to open it then it must be opened!





RSS

This first code is for checking the eye assy in the Elvis Eye Assy. It will allow you to check for Eye side to side, Up Down, Lid right and left up/down and lip up/down movements. Once these checks are made, make sure you write them down and subtract 200 from each one to allow for extra flow during motor off cycles. This data will be used in the next post I make. My numbers may vary from yours so make sure you do this test first so you don't bind up the motors or break a gear in the gearbox's. In the following pic use this a base for all VR connections. One circuit per VR. Use the center wire and the black wire on all VR pinouts. now here is the pic. and then the code.
' use this program to find the max an min VR setting for the Elvis Eye Assy.
' Follow the schematic and add one circuit per VR that is being checked.
' on each VR plug use the center wire and the black wire for all connections.
' used with a circuit with R = 10 k or 5K pot and C = 1.0 uf Tantalum Capacitor.
' On the capacitor make sure of the poliarity of the cap + side goes to VDD 5V
' Adjust the pot and watch the value shown on the Debug screen change.
' Use this program to make the nessary distance checks for up/down on the eyes and lip
' {$STAMP BS2} 'STAMP directive (specifies a BS2)
' {$PBASIC 2.5}
EyeRT_LT VAR Word 'Word variable to hold result for rt/lt eye.
EYES_U_D VAR Word 'word variable to hold results for eyes up down
EyeLidLF VAR Word ' Word variable to hold results for eye lid left up down
EyeLidRT VAR Word ' Word variable to hold results for eye lid right up down
LIP_U_D VAR Word ' Word variable to hold results for the lip up down
CheckVRs:
HIGH 0 'Discharge the cap for EyeRT_LT
PAUSE 1 'for 1 ms.
RCTIME 0, 1, EyeRT_LT 'Measure RC charge time in 1ms for EYE right and left.
HIGH 1 ' Discarge the cap for EYES_U_D
PAUSE 1
RCTIME 1, 1, EYES_U_D
HIGH 2
PAUSE 1
RCTIME 2, 1, EyeLidLF
HIGH 3
PAUSE 1
RCTIME 3, 1, EyeLidRT
HIGH 4
PAUSE 1
RCTIME 4, 1, Lip_U_D
' show results on debug screen
DEBUG CLS, "EyeRT_LT = ", DEC EyeRT_LT, CR 'clear screen and Show value on screen then to next line.
DEBUG "EYES_U_D = ", DEC EYES_U_D, CR
DEBUG "EyeLidLF = ", DEC EyeLidLF, CR
DEBUG "EyeLidRT = ", DEC EyeLidRT, CR
DEBUG "LIP_U_D = ", DEC LIP_U_D, CR
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
GOTO CheckVRs
Enjoy! GWJax
GWJax, To Hack and make mods on robots is a life style and comes natural and not by choice. If a robot has a screw to open it then it must be opened!