Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
I also want to try sharp IR, but it is a little costly
look at the datasheet of the IR sensor to see the voltage-range response
just linearize it in an equation and don't worry about the error.
byte const rangeTable [128] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 76, 72, 68, 65, 62, 59, 57, 54, 52, 50, 48, 47, 45, 44, 42, 41, 40, 38, 37, 36, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28, 28, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10};
voltage = read_adc (); if (voltage > 127) return (10); return (rangeTable [voltage]);
Check out the link below it shows a method to linearize the data.http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html