Average code on serial available
This commit is contained in:
+8
-5
@@ -1,4 +1,5 @@
|
|||||||
#include "HX711.h"
|
#include <HX711.h>
|
||||||
|
|
||||||
|
|
||||||
HX711 scale;
|
HX711 scale;
|
||||||
|
|
||||||
@@ -48,12 +49,14 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print("one reading:\t");
|
//Serial.print("one reading:\t");
|
||||||
Serial.print(scale.get_units(), 1);
|
//Serial.print(scale.get_units(), 1);
|
||||||
Serial.print("\t| average:\t");
|
//Serial.print("\t| average:\t");
|
||||||
|
if (Serial.available() > 0) {
|
||||||
Serial.println(scale.get_units(10), 1);
|
Serial.println(scale.get_units(10), 1);
|
||||||
|
|
||||||
scale.power_down(); // put the ADC in sleep mode
|
scale.power_down(); // put the ADC in sleep mode
|
||||||
delay(500);
|
delay(100);
|
||||||
scale.power_up();
|
scale.power_up();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user