remap function from arduino programming
-
- Posts: 113
- 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: 1452
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 512 times
- Been thanked: 472 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: 1742
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 442 times
- Been thanked: 603 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