Shop OBEX P1 Docs P2 Docs Learn Events
inverting a contiguous scale of vaues — Parallax Forums

inverting a contiguous scale of vaues

mikeamikea Posts: 283
edited 2015-02-22 05:27 in Propeller 1
Hi, there has to be a more efficient way besides a huge if or case expression for what I'm trying to do. A variable will be on a scale between 0-256 for distance, up close is a low number. the output is the same scale 0-256, but up close (low number from variable) needs to be on the relative opposite end of the scale to go into phsa of a counter and be on longer/brighter. I'm not sure if it's the right idea, but I tried negating the variable value before it goes to phsa to hopefully swap the on/off time, but I haven't been able to get that to work. Thanks

Comments

Sign In or Register to comment.