Line tracer robot


Results 1 to 7 of 7

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    By what you provide, it will look like almost this
    Code:
    TRISB=%00001111
    
    
    LM_FWD         var     PORTB.4
    LM_REV         var     PORTB.5
    RM_FWD         var     PORTB.6
    RM_REV         var     PORTB.7
    
    MaskPORTB      var     byte
    PeriodHALF     var     word ' Variable for Half Speed period (pulsout)
    PeriodMIN      var     word ' Variable for Min Speed period (pulsout)
    
    ' You'll have to determine value for PeriodMIN & PeriodHALF here
    
    PORTB=0
    
    Start:
          MaskPORTB=(PORTB>>1) & $07 ' get only B1,B2,B3 value
          Select case maskportb
                 
                 'LS(0) CS(1) RS (0) LM_FWD(FULL SPEED) RM_FWD (FULL)
                 case 2 
                      LM_FWD =1
                      RM_FWD =1
                      
                 'LS(1) CS(1) RS (0) LM_FWD(HALF SPEED) RM_FWD (FULL)
                 case 3
                      pulsout LM_FWD, PeriodHALF
                      RM_FWD=1
    
                 'LS(0) CS(1) RS (1) LM_FWD(HALF) RM_FWD (MAX)
                 case 6
                      pulsout LM_FWD, PeriodHALF
                      RM_FWD=1
    
                 'LS(0) CS(0) RS (1) LM_FWD(MAX SPEED) RM_FWD (MIN)
                 case 4
                      LM_FWD = 1
                      pulsout RM_FWD,PeriodMIN
          end select
          goto start
    be sure of the way you interpret your sensor... i'm not sure about the info you provide.

    2. another things is how to control
    if the 3 Sensor = 1 3 times cross 4 junction, the robot will stop and turn 90 deg left (for example)
    you mean ?
    Last edited by mister_e; - 20th January 2005 at 01:29.
    Steve

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

Similar Threads

  1. Replies: 0
    Last Post: - 2nd February 2009, 23:23
  2. Using input from Switch to control a loop
    By MrRoboto in forum mel PIC BASIC
    Replies: 9
    Last Post: - 2nd February 2009, 05:02
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Need Help - Line Tracer Robot
    By pidot in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th August 2007, 14:58
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

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