UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

RPR220 Class

Module: rpr220

UPM module for the Grove IR reflective sensor. The sensitivity can be adjusted with the potentiometer on the sensor module. It has a range of approximately 15 mm, and a quick response time.
It detects high-contrast dark areas on a light background.
This module allows the user to determine the current status (black detected or not). Additionally, if desired, an interrupt service routine (ISR) can be installed that is called when black is detected. Either method can be used, depending on your use case.
rpr220.jpg

Methods

RPR220

(
  • pin
)
Number

RPR220 constructor

Parameters:

  • pin Number

    Digital pin to use

Returns:

Number:

blackDetected

() Boolean

Gets the status of the pin; true means black has been detected

Returns:

Boolean:

True if the sensor has detected black

installISR

(
  • isr
  • arg
)

Installs an ISR to be called when black is detected

Parameters:

  • isr Function

    Pointer to a function to be called on interrupt

  • arg Void *

    Pointer to an object to be supplied as an argument to the ISR.

uninstallISR

()

Uninstalls the previously installed ISR