mixing joy stick


Results 1 to 18 of 18

Threaded View

  1. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Macgman2000 View Post
    I have only 8bit payload per pot. Actually its like flapperons,I am steering a tank. so to go right it mixes left and right motors in proportions, to steer from large arc to tight arc. To go straight it moves the left and right motor in tandum, same with reverse.
    Ok, tank-tread-erons...
    I'll cook it over in the brain for awhile...
    So then, values run from 0 to 255, 128 in the middle, say +/-16 for slop? 112-144 = no movement? Something along those lines?

    EDIT: done cooking...

    Without some better math (i.e. more bits at the input side), you'll lose some range at the output side of things (i.e. 0-223 vs. 0-255)...
    Code:
    inputvalue var byte
    outputvalue var byte
    deadband var byte
    deadband = 32
    
    if ( input > ( 128 + ( deadband / 2 ) ) ) or ( input < ( 128 - ( deadband / 2 ) ) ) then
         output = 128   'set output to middle value
    else
         if input > ( 128 + ( deadband / 2 ) ) then
              input = input - deadband
         endif
    endif
    The total range is reduced to the max byte value (255) minus the total deadband (32 in this case) which equals 223, so 0=minimum, 223=maximum.
    But that's just one way to do it...
    Last edited by skimask; - 16th October 2008 at 03:52.

Similar Threads

  1. Parallax Memory Stick Datalogger using SPI
    By djmachine in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th March 2009, 03:04
  2. Mixing basic and assembly
    By ManInMotion in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd September 2008, 09:48
  3. Displaying messages with only 7 (or 4) LEDs on a stick...
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 20th May 2007, 08:35
  4. PBP and assembler mixing - weird goings-on?
    By Giulio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th November 2006, 21:17
  5. USB memory stick
    By Demon in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 12th July 2005, 20:57

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