Is there anyone here who will be assisting with the following
In Arduino used "map" procodure.
How to make "map" procodure in Flowcode 7 ??
Can you give a code eksemple?
Code:
Channel 2 = map (Channel 2, 970, 1970, 0, 255); // Change input about two 0-255 Bytes
Signal from receiver 970-1970
See Web link here!
http://forum.arduino.cc/index.php?topic=3922.0
R / C receiver ouput from c ++ to flowcode
Moderator: Benj
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: R / C receiver ouput from c ++ to flowcode
Hi Monie,
Can you just do something like this.
NewNumber should now be in the range 0 - 255.
Or if you don't want to use floating point maths then you could use this to get an approximation 0 - 250.
You may need to do additional bounds checking on Number to ensure you are in range.
e.g.
Can you just do something like this.
Code: Select all
FloatVar = Number (970 to 1970)
FloatVar = FloatVar - 970.0
FloatVar = FloatVar / 3.90626
NewNumber = FloatVar
Or if you don't want to use floating point maths then you could use this to get an approximation 0 - 250.
Code: Select all
IntVar = Number (970 to 1970)
IntVar = IntVar - 970
IntVar = IntVar / 4
NewNumber = IntVar
e.g.
Code: Select all
if ( (Number >= 970) && (Number <= 1970) )
Yes : Code from above...
No: NewNumber = 0
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: R / C receiver ouput from c ++ to flowcode
Hi Benj
Many, many thanks for the info.
Many, many thanks for the info.
Best Regard
Monie
Monie
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: R / C receiver ouput from c ++ to flowcode
Flowcode example of the map function now available here: http://www.matrixtsl.com/mmforums/viewt ... 136#p77099
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel