I have two motors, dc gear motors, and 2 sensors, (1 switch and 1 momentary switch).

My code below does not compile, i get alot of errors(see bottom), can anyone help. I want to have the motors run to move robot forward until switch is 1 or until momentary switch is 0 and then reverse one motor and stop the other motor for 2 seconds. Then continue in endless loop.

==================

b0 var byte 'count


start:

if(PORTA.1 = 1) then
'edge detected
for b0=1 to 2
gosub backup
next

end if

if (PORTA.2=0) then
'obstacle detected
for b0=1 to 2
gosub backup
next


if (PORTA.1=0 && PORTA.2=1) then
'no edge or obstacle detected
gosub forward
endif

goto start

'===============
subroutines
'===============

backup:
PORTB.7=high 'enable pin
PORTB.6=low 'stop this side
PORTB.5=low

PORTB.4=low 'reverse this side
PORTB.3=high
PORTB.2=high 'enable pin

return

forward:
PORTB.7=high 'enable pin
PORTB.6=high
PORTB.5=low

PORTB.4=high
PORTB.3=low
PORTB.2=high 'enable pin

return
===================
===================
-------
errors
-------
ERROR Line 12: ':' or '=' Expected (Token 'var') (BASIC CODE from book test.bas)
ERROR Line 17: Variable Expected (Token '(') (BASIC CODE from book test.bas)
ERROR Line 17: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 23: End of Line or ':' Expected (Token 'if') (BASIC CODE from book test.bas)
ERROR Line 25: Variable Expected (Token '(') (BASIC CODE from book test.bas)
ERROR Line 25: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 32: Variable Expected (Token '(') (BASIC CODE from book test.bas)
ERROR Line 32: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 35: ':' or '=' Expected (BASIC CODE from book test.bas)
ERROR Line 41: ':' or '=' Expected (BASIC CODE from book test.bas)
ERROR Line 45: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 45: ':' or '=' Expected (Token '7') (BASIC CODE from book test.bas)
ERROR Line 46: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 46: ':' or '=' Expected (Token '6') (BASIC CODE from book test.bas)
ERROR Line 47: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 47: ':' or '=' Expected (Token '5') (BASIC CODE from book test.bas)
ERROR Line 49: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 49: ':' or '=' Expected (Token '4') (BASIC CODE from book test.bas)
ERROR Line 50: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 50: ':' or '=' Expected (Token '3') (BASIC CODE from book test.bas)
ERROR Line 51: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 51: ':' or '=' Expected (Token '2') (BASIC CODE from book test.bas)
ERROR Line 58: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 58: ':' or '=' Expected (Token '7') (BASIC CODE from book test.bas)
ERROR Line 59: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 59: ':' or '=' Expected (Token '6') (BASIC CODE from book test.bas)
ERROR Line 60: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 60: ':' or '=' Expected (Token '5') (BASIC CODE from book test.bas)
ERROR Line 62: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 62: ':' or '=' Expected (Token '4') (BASIC CODE from book test.bas)
ERROR Line 63: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 63: ':' or '=' Expected (Token '3') (BASIC CODE from book test.bas)
ERROR Line 64: Illegal Character '.' (BASIC CODE from book test.bas)
ERROR Line 64: ':' or '=' Expected (Token '2') (BASIC CODE from book test.bas)
=======================