changeset 5:ea44b28e12ab

1.0.2 update - setup now resets the object
author ark
date 2017-06-22 01:42 +0200
parents 53e0509faa3c
children 4e32bc18a7f7
files Potentiometer.cpp Potentiometer.h library.properties
diffstat 3 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Potentiometer.cpp	Fri Jun 02 22:09:56 2017 +0200
+++ b/Potentiometer.cpp	Thu Jun 22 01:42:31 2017 +0200
@@ -1,9 +1,4 @@
-#if defined(ARDUINO) && ARDUINO >= 100
 #include "Arduino.h"
-#else
-#include "WProgram.h"
-#endif
-
 #include "Potentiometer.h"
 
 
@@ -16,6 +11,10 @@
 void Potentiometer::setup(byte pin) {
     this->pin = pin;
     pinMode(this->pin, INPUT);
+    this->isStopped = false;
+    this->sum = 0.0;
+    this->avg = 0.0;
+    this->num = 0;
 }
 
 void Potentiometer::update() {
--- a/Potentiometer.h	Fri Jun 02 22:09:56 2017 +0200
+++ b/Potentiometer.h	Thu Jun 22 01:42:31 2017 +0200
@@ -22,7 +22,7 @@
         Potentiometer();
 
         /**
-            setup pot instance.
+            setup or reset pot instance.
             @param {byte} pin   input pin
         */
         void setup(byte pin);
--- a/library.properties	Fri Jun 02 22:09:56 2017 +0200
+++ b/library.properties	Thu Jun 22 01:42:31 2017 +0200
@@ -1,9 +1,9 @@
 name=Potentiometer
-version=1.0.1
+version=1.0.2
 author=Arkadiusz Juszczyk <arkadiusz@wobblyhead.net>
 maintainer=Arkadiusz Juszczyk <arkadiusz@wobblyhead.net>
 sentence=Dejittered potentiometer for Arduino
-paragraph=Encapsulates de-jittered potentiometer
+paragraph=Handles jitter averaging on a potentiometer to deliver a stable value.
 category=Signal Input/Output
 url=https://hg.wobblyhead.net/arduino/Potentiometer
 architectures=*