Skip to content

map function high to low #90

@jbobrow

Description

@jbobrow

Currently the map() function works with the following:
map(var, low_input, high_input, low_output, high_output)

i.e. lo,hi,lo,hi

I would like to have the function also work for the following:
lo,hi,hi,lo
hi,lo,hi,lo
hi,lo,lo,hi

Some common use case examples are mapping the remaining time from a timer which is going from high to low or wanting to dim brightness with the increase of a variable... All in all these are conveniences, but I have found that only working properly for the lo,hi,lo,hi makes it easy to make mistakes the the 3 other possible configurations. Working with words still makes sense, no need to account for negative numbers, I think that is a fine place to draw the line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions