Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
src
EMASonicRanger.h
1
#pragma once
2
3
#include <stdint.h>
4
#include "SonicRanger.h"
5
13
class
EMASonicRanger
:
public
SonicRanger
{
14
public
:
26
EMASonicRanger
(
const
uint8_t trigPin,
const
uint8_t echoPin,
const
uint16_t periodMs=10,
const
float
alpha=0.5,
const
uint16_t minimumRange=3);
27
32
void
begin
();
33
40
void
update
();
41
45
uint16_t
getRange
();
46
47
private
:
48
uint16_t _periodMs;
49
float
_alpha;
50
uint32_t _lastUpdated;
51
float
_movingAverage;
52
uint16_t _lastSample;
53
uint16_t _minimumRange;
54
55
};
56
EMASonicRanger::update
void update()
Definition:
EMASonicRanger.cpp:21
EMASonicRanger::begin
void begin()
Definition:
EMASonicRanger.cpp:13
EMASonicRanger::EMASonicRanger
EMASonicRanger(const uint8_t trigPin, const uint8_t echoPin, const uint16_t periodMs=10, const float alpha=0.5, const uint16_t minimumRange=3)
Definition:
EMASonicRanger.cpp:5
EMASonicRanger::getRange
uint16_t getRange()
Definition:
EMASonicRanger.cpp:33
SonicRanger
Definition:
SonicRanger.h:17
EMASonicRanger
SonicRanger with EMA-smoothed values.
Definition:
EMASonicRanger.h:13
Generated by
1.8.15