PROGRAM NAME CREATED VIA NEW PROJECT!!
COPY AND PASTE FROM NEXT LINE DOWN
'***********************************************
Dim duration as Integer
'***********************************************
Sub Procedure Forward
PortB = %00000000
Delay_ms(10)
PortB = %00101101
Delay_ms(50)
end sub
'***********************************************
Sub Procedure Reverse
PortB = %00000000
Delay_ms(10)
PortB = %00110011
Delay_ms(50)
end sub
'***********************************************
Sub Procedure T_Left
PortB = %00000000
Delay_ms(10)
PortB = %00101011
Delay_ms(50)
end sub
'***********************************************
Sub Procedure T_Right
PortB = %00000000
Delay_ms(10)
PortB = %00110101
Delay_ms(50)
end sub
'***********************************************
Sub Procedure Halt
PortB = %00000000
end sub
'***********************************************
Main:
TrisB = %00000000 ' Configure pins of PortB as output
TrisA = %00001100 ' Configure some pins of PortA as input(1)
CMCON = %00000111
While True
If TestBit(PortA,2) = 0 Then
Halt
Delay_ms(1000)
'*******
duration = 20 ' Make this number bigger to make it do it longer
While duration > 0
Reverse
duration = duration - 1
Wend
'*******
duration = 20 ' Make this number bigger to make it do it longer
While duration > 0
T_Right
duration = duration - 1
Wend
'*******
End If
If TestBit(PortA,3) = 0 Then
Halt
Delay_ms(1000)
'*******
duration = 20 ' Make this number bigger to make it do it longer
While duration > 0
Reverse
duration = duration - 1
Wend
'*******
duration = 20 ' Make this number bigger to make it do it longer
While duration > 0
T_Left
duration = duration - 1
Wend
'*******
End If
Forward
Wend
End.