Hi
I made my $50 robot, it works well and i have also added UART to my $50 robot. I was able to collect readings of Photoresistors through the UART. now I'm going to add IR range finder to my $50 robot. I'm using SHARP GP2Y0A21YK0F range finder. I'm going to calibrate it and the problem is, it gives me almost same reading regardless of the distance with the object. data sheet says it works accurately between 10cm to 80cm. i kept the object distance 10, 20, 30, 40, 50, 60, 70, and 80cm and took 10 readings of each distance with the following code. but always it give almost same range of readings.
for( i=0; i<10; i++){
sensor_ir=a2dConvert8bit(3);
rprintf("IR Reading: %d\r\n", sensor_ir);
delay_cycles(40000);
}
it always gives set of data like this
IR Reading: 156
IR Reading: 156
IR Reading: 156
IR Reading: 156
IR Reading: 138
IR Reading: 156
IR Reading: 114
IR Reading: 156
IR Reading: 131
IR Reading: 157
IR Reading: 130
IR Reading: 115
IR Reading: 156
IR Reading: 156
IR Reading: 156
IR Reading: 156
IR Reading: 149
IR Reading: 156
IR Reading: 147
IR Reading: 156
IR Reading: 156
IR Reading: 156