MappingFunction working for one sensor and not another #1031
mattibatti
started this conversation in
General
Replies: 2 comments 1 reply
-
Hi following up to see if anyone has an idea of why I am still only getting limited range output from my sensor? I have tried every thing I can think of :/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Please provide some more debugging information: template <size_t I>
analog_t mappingFunction(analog_t raw) {
analog_t constr = constrain(raw, minimum_values[I], maximum_values[I]);
analog_t ret = map(constr, minimum_values[I], maximum_values[I], 0, 16383);
if (I == 1)
Serial << raw << '\t' << constr << '\t' << ret << '\n';
}
void setup() {
Serial.begin(115200);
// ...
} Keep in mind that your ADC is only 10 bits, whereas the raw values are converted to 14 bits using |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to map the input from a softpot and a tilt sensor to control changes using the Potentioeter.map() example. The mapping is working great for the softpot, but the tilt sensor is only transmitting changes from 35-45, instead of 0-127. I have tried using multiple different values in the mapping function but nothing seems to work. Any ideas? Thanks so much.
Beta Was this translation helpful? Give feedback.
All reactions