Remap Function

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times

Remap Function

Post by Bruno »

Hello at all
I usually use a macro to remap outputs of different types of sensors. I saw that a "Map function" component was created in FC9.
I want to share this macro and the assembled component, for everyone who still has FC8 like me.. It works with both Int and float variables
Suggestions for improvements are accepted
Thanks
Attachments
Remap_Component.fcfx
Macro
(9.98 KiB) Downloaded 205 times
Remapping.fcpx
Component
(1.65 KiB) Downloaded 196 times
Remap_Test.fcfx
Example
(10.88 KiB) Downloaded 186 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Remap Function

Post by medelec35 »

Hi Bruno.
Thank you for creating the Map component.
My suggestion would be to use a single Long for the calculations as just using ints will cause rollover to occur.
See here.
Credit to our VC member mnf for spotting the issue with the v9 version.
Martin

User avatar
Bruno
Posts: 67
Joined: Thu Jan 18, 2018 2:11 pm
Been thanked: 21 times

Re: Remap Function

Post by Bruno »

Hi medelec
Thanks for your suggestion, I also had variable overflow problems,
in fact I used a Long variable, even though I wrote Int. :) :)

regards

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Remap Function

Post by AbhijitR »

Hello! Bruno

First of all many thanks for this post and for the component, to be honest I was struggling with the INT calculations because of the rollover issue but your Floating Variable in the component solved my problem. I do appreciate your thought for making the component for users who are not using V9 and V10 still.

As you mentioned in your post for suggestions, kindly excuse me to speak my mind, but I think your component will get complete by adding the CLAMPING function too in the Parameters, no doubt it is as per your convenience and time availability.

Once again thank you for this nice component.

Regards
Abhi

Post Reply