auto camera pointing

Satchid

Member
Thank you Hippy and Erco,
The prototype is working. Need some refinement.

I could not have done it without your help.
Willy
 

Satchid

Member
How do I send a video on the forum?

The project is stil in pieses. The base and the pan is not connected at the moment

Here te simple code for the pan:
Code:
 ;sensor following camera panning
'28x2 on shield Base and instant robot shield
' picaxe pin assignment for DC motor

;S.8 Motor A Direction
;S.9 Motor A Control (On/Off/PWM)
;S.10 Motor B Control (On/Off/PWM)
;S.11 Motor B Direction
setfreq m16
#picaxe 28x2


#no_data 'Prevent data from being downloaded to PICAXE._
	symbol sen_L   = pina.0 'Assign symbol sen1_in to input 0
	symbol sen_R   = pina.1 'Assign symbol sen2_in to input 2
	
	symbol motor_A_dir = s.8  ;s.8 Motor A Direction
	symbol motor_A	 = s.9  ;S.9 Motor A Control (On/Off/PWM)
;	symbol motor_B	 = s.10 ;S.10 Motor B Control (On/Off/PWM)
;	symbol motor_B_dir = s.11 ;S.11 Motor B Direction
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;	
		;P R O G R A M 
start:	

	b1 = sen_r ;not needed but for debug
	b2 = sen_l ;not needed but for debug
      if sen_R = 0 and sen_L = 0 then gosub motorOFF 	;goto stop motor
	if sen_R = 0 and sen_L = 1 then gosub right	
	if sen_L = 0 and sen_R = 1 then gosub left

;	debug
;	pause 500
left:
High motor_A_dir 	;set direction of motor
goto motorA		;goto start motor
goto start

right:
low motor_A_dir	;set direction of motor
goto motorA		;goto start motor
goto start

motorA:
high motor_a    	;start motor
goto start

motorOFF:
low motor_A		;stop motor
goto start


end
 
Last edited:

PieM

Senior Member
Code:
if sen_L = 0 and sen_R = 1 then [COLOR=#ff0000]gosub[/COLOR] left
........
left:
High motor_A_dir     ;set direction of motor
goto motorA        ;goto start motor
[COLOR=#ff0000]goto[/COLOR] start
Manual2:
The gosub (‘goto subprocedure’) command is a ‘temporary’ jump to a separate
section of code, from which you will later return (via the return command). Every
gosub command MUST be matched by a corresponding return command. Do not
confuse with the ‘goto’ command which is a permanent jump to a new program
location.
 
Top