Page 1 of 1

remap function from arduino programming

Posted: Wed Mar 20, 2024 10:00 pm
by solozerouno
There is the possibility of converting from 10bit to 8bit with the function in C "REMAP" for Arduino in which, for example, a value is read from A0 and refers to the Pwm, for which the bits are read at 10 and written at 8 .. ... How is it with Flc10 ? Thanks Solozerouno

Re: remap function from arduino programming

Posted: Wed Mar 20, 2024 10:39 pm
by medelec35
Hello.
Of course, the built-in remap function can do that.
However, the most efficient way to convert 10bit to 8 bit is:

Code: Select all

ADC = ADC >> 2
All the code is doing is bit shifting by 2 places which is the same as dividing by 4.

Re: remap function from arduino programming

Posted: Thu Mar 21, 2024 9:50 am
by BenR
Hello,

We have a component to do the REMAP function if required, it's available under Math -> Map Function.

Martin's suggestion of bitshifting is probably best if you're just looking to reduce the bit depth.