remap function from arduino programming
-
- Posts: 116
- http://meble-kuchenne.info.pl
- Joined: Tue Dec 08, 2020 4:36 am
- Has thanked: 2 times
- Been thanked: 2 times
remap function from arduino programming
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
-
- Matrix Staff
- Posts: 1560
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 555 times
- Been thanked: 514 times
Re: remap function from arduino programming
Hello.
Of course, the built-in remap function can do that.
However, the most efficient way to convert 10bit to 8 bit is:
All the code is doing is bit shifting by 2 places which is the same as dividing by 4.
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
Martin
-
- Matrix Staff
- Posts: 1882
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 484 times
- Been thanked: 661 times
Re: remap function from arduino programming
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel