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
Page14_1
Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

Let's Dance!

PIC Home Previous Page Next Page Next Chapter

Page: 1

All you need to do here is modify the code from chapter 11. You just need to make a niffty dance routine. Please read page 95 of your manual for more details.
Golly this chapter is easy!

You are ready to program

Copy and Pastable code


Click here for alternate code for robots with "Motor noise issues"

Be sure to create a new project first.
For a review of creating projects please go here
Paste BELOW your program name!
PROGRAM NAME CREATED VIA NEW PROJECT!!
COPY AND PASTE FROM NEXT LINE DOWN
'***********************************************
Dim duration as Integer
Dim steps 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
       'Forward step****
       duration = 50     ' Make this number bigger to make it do it longer
       While duration > 0
       Forward
       duration = duration - 1
       Wend
       'Reverse step****
       duration = 20     ' Make this number bigger to make it do it longer
       While duration > 0
       Reverse
       duration = duration - 1
       Wend
       'T_Right step****
       duration = 10     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Right
       duration = duration - 1
       Wend
       'T_Left step*****
       duration = 10     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Left
       duration = duration - 1
       Wend
       'T_Right step****
       duration = 10     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Right
       duration = duration - 1
       Wend
       'T_Left step*****
       duration = 10     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Left
       duration = duration - 1
       Wend
       'Reverse step****
       duration = 20     ' Make this number bigger to make it do it longer
       While duration > 0
       Reverse
       duration = duration - 1
       Wend
       'T_Right step****
       duration = 50     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Right
       duration = duration - 1
       Wend
       'T_Left step*****
       duration = 50     ' Make this number bigger to make it do it longer
       While duration > 0
       T_Left
       duration = duration - 1
       Wend

Wend
End.
PIC Home Previous Page Next Page Next Chapter

Page: 1

Robodyssey and the Robodyssey logo are trademarks of Robodyssey Systems, LLC
PIC is a registered trademark of Microchip Technology Inc. in the U.S. and other countries.
MikroBasic is a registered trademark of mikroElectronika Inc. in the U.S. and other countries.
Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery