microsurfer
New member
Hi All,
I'm using the map function on a teensy 3.2 & 3.5 but it's a littlebit confusing.
What I do:
//declare
byte R=3; // for example
byte P=0; // for example
byte I;
byte Y;
//in void loop
Y = map(I,0,127,R,P);
.////////
When i put in : I = 0 , Y only gets 2 or 1, (I forgot and Im not with the setup now) instead of getting 3 I was expecting.
When I do :
Y= map(I,127,0,P,R); and I= 0, Y Gets 3 as expected.
So I just swapped the low & high on both ranges. It works but I just don't understand it. Is this the right behaviour ?
Can anybody explain this?
I am using arduino 1.8.7 and 4+ teensduino.
I'm using the map function on a teensy 3.2 & 3.5 but it's a littlebit confusing.
What I do:
//declare
byte R=3; // for example
byte P=0; // for example
byte I;
byte Y;
//in void loop
Y = map(I,0,127,R,P);
.////////
When i put in : I = 0 , Y only gets 2 or 1, (I forgot and Im not with the setup now) instead of getting 3 I was expecting.
When I do :
Y= map(I,127,0,P,R); and I= 0, Y Gets 3 as expected.
So I just swapped the low & high on both ranges. It works but I just don't understand it. Is this the right behaviour ?
Can anybody explain this?
I am using arduino 1.8.7 and 4+ teensduino.
Last edited: