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.

HCSR04 Class

Module: hcsr04

This module defines the HC-SR04 interface for libhcsr04
groveultrasonic.jpg

Item Index

Methods

HCSR04

(
  • triggerPin
  • echoPin
)
Number

Instantiates an HCSR04 object

Parameters:

  • triggerPin Number

    Pin to trigger the sensor for distance

  • echoPin Number

    Pulse response to triggering

Returns:

Number:

getDistance

(
  • unit
)
Number

Gets the distance from the sensor

Parameters:

  • unit HCSR04_U

    Selects units for measurement

Returns:

Number: