From f212175b0958befa0a94bc616d21c7d1abb2ee12 Mon Sep 17 00:00:00 2001 From: Yurii Salimov Date: Wed, 30 Jan 2019 20:01:01 +0200 Subject: [PATCH] Updated documentation. --- README.md | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index dd898c6..5d896fd 100644 --- a/README.md +++ b/README.md @@ -76,82 +76,82 @@ boolean value = sensor->isHigh(); boolean value = sensor->isLow(); ``` -### [Map Sensor](/src/MapSensor.h) +### [Average Sensor](/src/AverageSensor.h) -Reads a signal from a origin sensor, maps the signal and return it. -Re-maps the signal from one range to another. -That is, a signal of fromLow would get mapped to toLow, -a signal of fromHigh to toHigh, signals in-between to signals in-between, etc. +Reads a signal from a origin sensor, +averages the signal and return it. ```cpp #include #include -#include +#include Sensor* origin = new AnalogSensor(ANALOG_PIN); /** - FROM_LOW - the lower bound of the value’s current range; - FROM_HIGH - the upper bound of the value’s current range; - TO_LOW - the lower bound of the value’s target range; - TO_HIGH - the upper bound of the value’s target range. + COUNTER - number of readings; + DELAY_TIME - delay time between readings. */ -Sensor* sensor = new MapSensor( - origin, - FROM_LOW, FROM_HIGH, - TO_LOW, TO_HIGH -); +Sensor* sensor = new AverageSensor(origin, COUNTER, DELAY_TIME); /** - Returns the mapped signal value. + Returns the average signal value. */ int value = sensor->read(); ``` -### [Average Sensor](/src/AverageSensor.h) +### [Smooth Sensor](/src/SmoothSensor.h) Reads a signal from a origin sensor, -averages the signal and return it. +smoothes (moving average, rolling average or running average) +the signal and return it. ```cpp #include #include -#include +#include Sensor* origin = new AnalogSensor(ANALOG_PIN); /** - COUNTER - number of readings; - DELAY_TIME - delay time between readings. + SMOOTHING_FACTOR - smoothing factor of readings (0 = not smooth). */ -Sensor* sensor = new AverageSensor(origin, COUNTER, DELAY_TIME); +Sensor* sensor = new SmoothSensor(origin, SMOOTHING_FACTOR); /** - Returns the average signal value. + Return the average signal value. */ int value = sensor->read(); ``` -### [SmoothSensor](/src/SmoothSensor.h) +### [Map Sensor](/src/MapSensor.h) -Reads a signal from a origin sensor, -smoothes (moving average, rolling average or running average) -the signal and return it. +Reads a signal from a origin sensor, maps the signal and return it. +Re-maps the signal from one range to another. +That is, a signal of fromLow would get mapped to toLow, +a signal of fromHigh to toHigh, signals in-between to signals in-between, etc. ```cpp #include #include -#include +#include Sensor* origin = new AnalogSensor(ANALOG_PIN); /** - SMOOTHING_FACTOR - smoothing factor of readings (0 = not smooth). + FROM_LOW - the lower bound of the value’s current range; + FROM_HIGH - the upper bound of the value’s current range; + TO_LOW - the lower bound of the value’s target range; + TO_HIGH - the upper bound of the value’s target range. */ -Sensor* sensor = new SmoothSensor(origin, SMOOTHING_FACTOR); +Sensor* sensor = new MapSensor( + origin, + FROM_LOW, FROM_HIGH, + TO_LOW, TO_HIGH +); /** - Return the average signal value. + Returns the mapped signal value. */ int value = sensor->read(); ```