How to adjust values to a new range


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: How to adjust values to a new range

    There is a mistake on B13, it should be MIN(B12;B7)

    Ioannis

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: How to adjust values to a new range

    As I turn the pot, the formula should convert from 0 all the way to 1023, to a new range of 100 to 235
    Code:
    OutputValue = 100 + (InputValue */ 34)

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: How to adjust values to a new range

    Many ways to skin a cat but Henriks is the best!

    Fast and simple!

    Ioannis

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: How to adjust values to a new range

    Quote Originally Posted by HenrikOlsson View Post
    Code:
    OutputValue = 100 + (InputValue */ 34)
    That's awesome Henrik. It works like a charm.

    Can you explain how you got 34? It's not jumping out at me.

    "A simple way to think about '*/' is that it shifts the result 8 places to the right,
    resulting in an automatic division by 256.
    "

    I'm just not sure how you went about figuring that out.

    I'd like to convert 34 into a formula for future use when I have to use a different range (cause I'm sure to have that need - several Flight Sim variables use pots and have their own range of values).
    Last edited by Demon; - 15th August 2024 at 20:16.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: How to adjust values to a new range

    Quote Originally Posted by Ioannis View Post
    There is a mistake on B13, it should be MIN(B12;B7)

    Ioannis
    Good eye.

    I had corrected the formula in B13, but had somehow missed the text in C13 (it's just text to show what goes on in the real cells in B column).
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Simple way to adjust interrupt speed in DT_INTS-14 ?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th January 2015, 13:01
  2. Use a pot to adjust COUNT value
    By Sam in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th November 2011, 16:56
  3. Select Case range of values
    By kenif in forum PBP Wish List
    Replies: 3
    Last Post: - 25th June 2009, 14:27
  4. Replies: 9
    Last Post: - 31st July 2008, 09:56
  5. If Then Range
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th June 2005, 15:33

Members who have read this thread : 5

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