Serin serout problem


Results 1 to 40 of 337

Threaded View

  1. #29
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok I am doing a remote control for my robot I wrote a code below, It seems long, Maybe you have a better idea. I am using two Potentiometer , the values of each will control the left and right motor of the robot:

    'Remote control*****************

    direction var word : speed var word

    Loop:
    If (left => 115) AND (left <= 135) AND (right => 115) AND (right <= 135) then
    goto stop

    If (left => 115) AND (left <= 135) AND (right <= 115) then 'left is stop, right is CCW
    goto LeftstopRightCCW

    If (left => 115) AND (left <= 135) AND (right => 135) then 'left is stop , right is CW
    goto LeftstopRightCW

    If (right => 115) AND (right <= 135) AND (right <= 115) then 'right is stop, left is CCW
    goto RightstopLeftCCW

    If (right => 115) AND (right <= 135) AND (right => 135) then 'right is stop , left is CW
    goto RightstopLeftCW

    If (left > 135) AND (right > 135) then 'Left Cw & right CW
    goto LeftCWRightCW

    If (left > 135) AND (right < 135) then 'Left CW & right CCW
    goto LeftCWRightCCW

    If (left < 135) AND (right > 135) then 'Left CCW & right CW
    goto LeftCCWRightCW

    If (left < 135) AND (right < 135) then 'Left CCW & right CCW
    goto LeftCCWRightCCW

    In brief:
    'Stop '--------------------------------$69 = 01 10 10 01
    'Leftwheel =stop : Rightwheel= CCW '--- $A6 = 10 10 01 10
    'Leftwheel =stop : Rightwheel= CW '----- $96 = 10 01 01 10
    'Leftwheel =CCW : Rightwheel= stop '---- $9a = 10 01 10 10
    'Leftwheel =CW : Rightwheel= stop '----- $A5 = 10 10 01 01
    'Leftwheel =CW : Rightwheel= CW '---- $66 = 01 10 01 10
    'Leftwheel =CW : Rightwheel= CCW '---- $56 = 01 01 01 10
    'Leftwheel =CCW : Rightwheel= CW '---- $5a = 01 01 10 10
    'Leftwheel =CCW : Rightwheel= CCW '---- $65 = 01 10 01 01
    Last edited by lerameur; - 7th January 2007 at 21:29.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

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