Smartcar Shield
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | List of all members
SR04 Class Reference

The SR04 (aka SRF05) is an inexpensive ultrasonic sensor controllable over two digital pins. More...

#include <SR04.hpp>

Inheritance diagram for SR04:
Inheritance graph
Collaboration diagram for SR04:
Collaboration graph

Public Member Functions

 SR04 (uint8_t triggerPin, uint8_t echoPin, unsigned int maxDistance, Runtime &runtime)
 
unsigned int getDistance () override
 
unsigned int getMedianDistance (uint8_t iterations=smartcarlib::constants::sr04::kDefaultIterations) override
 

Detailed Description

The SR04 (aka SRF05) is an inexpensive ultrasonic sensor controllable over two digital pins.

For a more advanced solution (faster readings, not using pulseIn, non-blocking measurements etc) please use the NewPing library.

Examples:
SR04.ino.

Definition at line 34 of file SR04.hpp.

Constructor & Destructor Documentation

SR04::SR04 ( uint8_t  triggerPin,
uint8_t  echoPin,
unsigned int  maxDistance,
Runtime runtime 
)

Definition at line 19 of file SR04.cpp.

Member Function Documentation

unsigned int SR04::getDistance ( )
override

Definition at line 39 of file SR04.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int SR04::getMedianDistance ( uint8_t  iterations = smartcarlib::constants::sr04::kDefaultIterations)
override

Definition at line 57 of file SR04.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: