Main Site Documentation

Modification to FEZ_Components_DistanceDetector.cs for GP2Y0A02YK0F


#1

Hi,

I have a Sharp proximity sensor model GP2Y0A02YK0F.

Currently the driver (FEZ_Components_DistanceDetector.cs) only has types GP2Y0A21YK and GP2D120.

GP2Y0A02YK0F has a range of 15cm - 150cm.

Would this be the correct parameters to add to the ‘DistanceDetector’ method:


                    //New Sharp sensor type.
                    case SharpSensorType.GP2Y0A02YK0F:
                        Y0 = 15; //15cm
                        X0 = 315; //Not sure what this is
                        Y1 = 150; //150cm
                        X1 = 30;  //Not sure what this is
                        break;
                    case SharpSensorType.GP2Y0A21YK:
                        Y0 = 10;
                        X0 = 315;
                        Y1 = 80;
                        X1 = 30;
                        break;
                    case SharpSensorType.GP2D120:
                        Y0 = 3;
                        X0 = 315;
                        Y1 = 30;
                        X1 = 30;
                        break;

Thanks,
RJ


#2

Cool thanks


#3

Though, I think Y0 should be 20 not 15?

case SharpSensorType.GP2Y0A02YK0F:
Y0 = 15; //15cm
X0 = 315; //Not sure what this is
Y1 = 150; //150cm
X1 = 30; //Not sure what this is
break;

X0,X1 seems to represent angle from which the sensor covers for example from 30 degree line to 315 degree


#4

Thanks Hai,

This would explain why close measurements were a little out.