Hello,
I am using tcs3200 colour sensor and I am reading 2 diffrent value(highest and lowest) .
I want cconver this 2 value between 0-255 like arduino map() function but values not being between 0-255.
Example
map(SensorValue,30,70,0,255)
this is the code I used.
int map(int x, int in_min, int in_max, in out_min, in out_max)
{
return (x - in_min) * (out_max - out_min + 1) / (in_max - in_min + 1) + out_min;
}