GP2Y0A Class
- ID: gp2y0a
- Name: Analog Infrared (IR) Based Distance Sensor
- Other Names: Grove 80cm IR Proximity Sensor
- Category: light
- Manufacturer: seeed
- Connection: analog
- Link: http://wiki.seeed.cc/Grove-80cm_Infrared_Proximity_Sensor/
Sensors of this family return an analog voltage corresponding to the distance of an object from the sensor. The voltage is lower when objects are far away; the voltage increases as objects get closer to the sensor.
Methods
GP2Y0A
(
Number
-
pin
GP2Y0A sensor constructor
Parameters:
-
pin
NumberAnalog pin to use
Returns:
Number:
value
(
Number
-
aref
-
samples
Gets an average voltage value from the sensor
Parameters:
-
aref
NumberReference voltage in use (usually 5.0V or 3.3V)
-
samples
NumberNumber of samples to average over
Returns:
Number:
Average voltage reading