HCSR04 Library
|
Class which can create objects which can calculate speed. Requires object distance sensor. More...
#include <HCSR04.h>
Public Member Functions | |
speedometer (distancemeter &meter) | |
long long int | getSpeed (Unit unit=Unit::Ms, int delay=10) |
Calculates the speed of a moving object. More... | |
int | getFreq (int measurements, Unit unit=Unit::Hz, int delay1=10, int delay2=100) |
Calculates the frequency of a moving object. More... | |
Class which can create objects which can calculate speed. Requires object distance sensor.
|
inline |
Calculates the frequency of a moving object.
The parameter "int measurements" represents the amount of times the getSpeed() function will be called in total.
The parameter "Freq unit" represents the output unit. Use "Unit::Hz for hertz and use "Unit::mHz" for millihertz.
The parameter "int delay1" represents the delay between the getSpeed() calls.\n
The parameter "int delay2" represents the delay between the two distance measurements inside the function getSpeed().
TO BE TESTED
|
inline |
Calculates the speed of a moving object.
This function can output in 3 units by using the "unit" parameter.
For meter per second use "Unit::Ms".
For kilometers per hour use "Unit::Kmh".
For miles per hour use "Unit::Mh".
For centimeters per second use "Unit::Cms"
The default unit is meter per second.
Note: Be aware that enumerations are case sensitive.
The second parameter, int delay, is used for specifying the delay between the two distance measurements.
The faster the object, the shorter the delay should be.
The delay parameter is in milliseconds.