Average code on serial available

master
Wilhelm Westermark 6 years ago
parent 9ee108ee57
commit 974894f1ee

@ -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");
Serial.println(scale.get_units(10), 1); if (Serial.available() > 0) {
Serial.println(scale.get_units(10), 1);
scale.power_down(); // put the ADC in sleep mode
delay(500); scale.power_down(); // put the ADC in sleep mode
scale.power_up(); delay(100);
scale.power_up();
}
} }

Loading…
Cancel
Save