jonathan campo / HX711

Dependents:   POF_force_angle_copy

Files at this revision

API Documentation at this revision

Comitter:
hi1000
Date:
Sat Apr 13 05:55:06 2019 +0000
Parent:
1:a2666eae3d06
Child:
3:99fd973e73c4
Commit message:
Pin assignment is confirmed

Changed in this revision

HX711.cpp Show annotated file Show diff for this revision Revisions of this file
HX711.h Show annotated file Show diff for this revision Revisions of this file
--- a/HX711.cpp	Mon Mar 20 13:07:36 2017 +0000
+++ b/HX711.cpp	Sat Apr 13 05:55:06 2019 +0000
@@ -108,9 +108,9 @@
     _scale = scale;
 }
  
-float HX711::getGram()
+float HX711::getGram(uint8_t times)
 {
-    long val = (averageValue() - _offset);
+    long val = (averageValue(times) - _offset);
     return (float) val / _scale;
 }
  
--- a/HX711.h	Mon Mar 20 13:07:36 2017 +0000
+++ b/HX711.h	Sat Apr 13 05:55:06 2019 +0000
@@ -39,7 +39,7 @@
     int averageValue(uint8_t times = 25 );
     void setOffset(int offset);
     void setScale(float scale = 1990.f);
-    float getGram();
+    float getGram(uint8_t times = 5);
     void setGain(uint8_t gain);
     void powerDown();
     void powerUp();