Average code on serial available

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

@ -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);
scale.power_down(); // put the ADC in sleep mode
delay(500);
scale.power_up();
//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(100);
scale.power_up();
}
}

Loading…
Cancel
Save