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