robot program


Closed Thread
Results 1 to 3 of 3

Thread: robot program

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Usually, you won't get replies for this kind of request.

    I am on my good day t0day!

    Code:
    b0 var byte
    b1 var byte
    b2 var byte
    
    start:
         pot 1, 255,b0   'Read CdS cell # 1
         pot 2, 255,b1   'Read CdS cell # 2
         If b0 = b1 then straight
         if b0 > b1 then left
         if b1 > b0 then right
    
    straight:
         high 3
         high 4
         goto start
    
    left:
         b2 = b0 - b1          'Compare numerical values +/15
         if b2 > 15 then left1 'If greater than 15 turn left
         goto straight         'If not go to straight subroutine
    
    left1:                     'Turn left
         high 3
         low 4                 'Motor control
         goto start
    
    right: 'Compare numerical values +/15
         b2 = b1 - b0           'If greater then 15 points
         if b2 > 15 then right1 'Turn toward the right
         goto straight          'If not go straight
    
    right1:                     'Turn right
         high 4
         low 3                  'Motor control
         goto start 'Do again

    Now, at least, you should be able to say what your mistake was.

    Can you?


    ===================
    Last edited by sayzer; - 8th January 2008 at 16:38.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  3. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. PIC16F684 Program question
    By Nicholas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2006, 14:30

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts