28 lines
466 B
C++
28 lines
466 B
C++
#include<Arduino.h>
|
|
|
|
#include "HX711.h"
|
|
|
|
// HX711 circuit wiring
|
|
const int LOADCELL_DOUT_PIN = D2;
|
|
const int LOADCELL_SCK_PIN = D3;
|
|
|
|
HX711 scale;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
|
|
}
|
|
|
|
void loop() {
|
|
|
|
if (scale.wait_ready_retry(10)) {
|
|
long reading = scale.read();
|
|
Serial.print("HX711 reading: ");
|
|
Serial.println(reading);
|
|
} else {
|
|
Serial.println("HX711 not found.");
|
|
}
|
|
|
|
delay(1500);
|
|
|
|
} |