| ROBODYSSEY SYSTEMS LLC |
|
Product Catalog Code Page Policies Gallery Whats New Press Releases Resources Links Contact Us About Us Press Educators Page BasicX and Robotics book After School Mini Challenge! Free Robots to Kids Hack-A-Toy Shopping Cart |
Page21_4
|
| PIC Home | Previous Page | Next Page | Next Chapter |

PROGRAM NAME CREATED VIA NEW PROJECT!!
COPY AND PASTE FROM NEXT LINE DOWN
Dim x as Integer
'***********************************************
Sub Procedure Forward
PortB = %00101101
end sub
'***********************************************
Sub Procedure Reverse
PortB = %00110011
end sub
'***********************************************
Sub Procedure T_Left
PortB = %00101011
end sub
'***********************************************
Sub Procedure T_Right
PortB = %00110101
end sub
'***********************************************
Sub Procedure Halt
PortB = %00000000
end sub
'***********************************************
Sub Procedure ScanLeft
x = 50
While x > 1
x = x - 1
PortA = %00000010
Delay_us(18)
PortA = %00000000
Delay_us(10)
Wend
If TestBit(PortA,2) = 0 Then
Reverse
Delay_ms(500)
T_Right
Delay_ms(500)
End if
end sub
'***********************************************
Sub Procedure ScanRight
x = 50
While x > 1
x = x - 1
PortA = %00000001
Delay_us(18)
PortA = %00000000
Delay_us(10)
Wend
If TestBit(PortA,3) = 0 Then
Reverse
Delay_ms(500)
T_Left
Delay_ms(500)
End if
end sub
'***********************************************
Main:
TrisB = %00000000
TrisA = %00001100
CMCON = %00000111
'**************************************
While True
ScanLeft
ScanRight
Forward
Wend
End.
| PIC Home | Previous Page | Next Page | Next Chapter |
| Home | Product Catalog | Shopping Cart | Resources | Links |
| Code Page | Policies | Gallery |