Robastic
 

 
 
 

Modèles en papier

Robotique

Plus sur moi  ?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

'----------------------------robastic--------------------------
'-------------------My first Robotic Maggot--------------------
'-------------------------V2.4 mai.2001------------------------
'-------------CHEVREUIL Regis for private use only !----------- 

'init   ports declaration

symbol speed=4  'not used yet
symbol sho=0  'shoulder servo
symbol arm=1  'arm servo
symbol dir=2  'direction servo
symbol eye=4  'input for infra-red vision
symbol ldr=7  'input for ldr
'-------------------------------------------------------------
main :   'main loop 

gosub test 
gosub raise
gosub fold
gosub extend
goto main

'------------------------------------------------------------
raise :   'folding the body no contact with ground

for b0=1 to 20
pulsout sho,120  'shoulder up
pulsout arm,300  'arm fold
pulsout dir,127  'straight
pause 20
next 
return 

'------------------------------------------------------------
fold :   'body fold and contact with the ground
for b0=1 to 20
pulsout sho,140  'same as before but shoulder in middle
pulsout arm,310  'position to press on the ground
pulsout dir,127
pause 20
next
return

'--------------------------------------------------------------------
extend :  'extention loop go forward

for b0=1 to 30
pulsout sho,190  'shoulder down
pulsout arm,190  'arm extended
pulsout dir,127  'go straight
pause 20
next 
return
 

'---------------------------------------------------------------------
turnr : 'turning right loop

for b1 =0 to 2
gosub raise
gosub fold
for b0=1 to 20
pulsout sho,130  'turning the body
pulsout arm,300
pulsout dir,60
pause 20
next
next
goto main

'--------------------------------------------------------------------
turnl : 'turning left loop

for b1=0 to 2
gosub raise
gosub fold
for b0=1 to 20
pulsout sho,130  'turning the body
pulsout arm,300
pulsout dir,200
pause 20
next
next
goto main
 

'-------------------------------------------------------------------
test:                    'test for infra-red objects detection + light (LDR)
 pot 7,65,b2                 'measuring resistance of  LDR
 if b2>60 then stop       'if LDR value >60 then stop loop
 random w2                 'random choose for direction to take
 b5=w2//4                    'select random number
 if pin4=0 and b5>=2 then turnr          'check of IR eye and random choose
 if pin4=0 and b5<2 then turnl           'of direction to turn

return

'-----------------------------------------------------------------
stop:                               'stop loop if not enough light
 pot 7,65,b2                   'measure again to exit this loop
 if b2<50 then main         'exit loop if more light
 goto stop                       'if not, loop again !

Cliquez ici pour le schéma des pièces !