Home » Programming (API) » Programming the MRPi1 with python » proxSensor() – API python

proxSensor()

Description

Read the proximity distance sensors from the specified sensor.

Syntax

proxSensor(sensor)

Parameter

sensor : the sensor number (1 to 5)

Returns

  • Distance value: int 0 to 255 (millimeter unit)

Exemple :

  • 200 = 200 mm

Exemples

from mrpiZ_lib import *
import time

#read sensor 1

p1 = proxSensor(1)

#read sensor 2

p2 = proxSensor(2)

#read sensor 5

p5 = proxSensor(5)

print p1, p2, p5