robot program


Closed Thread
Results 1 to 3 of 3

Thread: robot program

  1. #1
    Join Date
    Jan 2008
    Posts
    7

    Question robot program

    can you help me determine the errors of this program?
    This is my program for my project in school.. Pls. Help an Reply...

    'Braitenberg vehicle 1
    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 '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 '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

  2. #2
    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

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi Ajak,
    Welcome on the forum.

    When you post a question, please tell us everything, PIC used, Crystal speed (or internal one), which compiler and it's version, and post your schematic if you have any. This will also help us to give you a better answer to your question.

    When you post your code, use the code tags, so your code format and indents will not be messed, easier for us to read it. What you need to do is to type

    [code]
    paste your code here
    [/code]


    When asking a question, elaborate as much as possible. Your post don't show any official question... no problem description, no observation either.
    Last edited by mister_e; - 8th January 2008 at 16:57.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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