Society of Robots - Robot Forum
Software => Software => Topic started by: amadord on March 22, 2010, 03:25:12 PM
-
I have this code inside the photovore program in arduino. I want to learn what it means.
here's the code:
sensor_right = map(sensor_right, 0, 1023, 0, 255);
what does the numbers mean?
-
um, a little more info plz. Can u plz post the code here?
-
Can you look or post the code for the function map()? That is where the answer may be.
-
That is a fancy way of converting a number that is originally from 0 to 1024 (typically ADC reading) to a 0 to 255 value. I believe it is Arduino code.
-
map(value, fromLow, fromHigh, toLow, toHigh)
Description
Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.
http://www.arduino.cc/en/Reference/Map (http://www.arduino.cc/en/Reference/Map)
-
I believe Razor is correct. Its converting the values from 0-1023 to 0-255. I assume its for a photovore?
-
okay thanks that explains. thank you very much