/*
Arduino | general-help
Eccentric Engineer — 9/22/24 at 9:25 PM
so i dont know if i have a hardware, firmware, or software problem,
or perhaps the problem might even be that i dont know what im doing
and its something really simple. i have a hk711 board and some load
cells connected to an arduino, and the code used is example code from
the adafruit hk711 library, so i at least know there shouldnt be any
issues from the code. with that being said, this is my output. i can
screen share (and would personally prefer it) if needed. for
thoroughness sake ill also post the code
*/
#include "Adafruit_HX711.h"
// Define the pins for the HX711 communication
const uint8_t DATA_PIN = 5; // Can use any pins!
const uint8_t CLOCK_PIN = 4; // Can use any pins!
Adafruit_HX711 hx711(DATA_PIN, CLOCK_PIN);
void setup() {
Serial.begin(115200);
// wait for serial port to connect. Needed for native USB port only
while (!Serial) {
delay(10);
}
Serial.println("Adafruit HX711 Test!");
// Initialize the HX711
hx711.begin();
// read and toss 3 values each
Serial.println("Tareing....");
for (uint8_t t=0; t<3; t++) {
hx711.tareA(hx711.readChannelRaw(CHAN_A_GAIN_128));
hx711.tareA(hx711.readChannelRaw(CHAN_A_GAIN_128));
hx711.tareB(hx711.readChannelRaw(CHAN_B_GAIN_32));
hx711.tareB(hx711.readChannelRaw(CHAN_B_GAIN_32));
}
}
void loop() {
// Read from Channel A with Gain 128, can also try CHAN_A_GAIN_64 or CHAN_B_GAIN_32
// since the read is blocking this will not be more than 10 or 80 SPS (L or H switch)
int32_t weightA128 = hx711.readChannelBlocking(CHAN_A_GAIN_128);
Serial.print("Channel A (Gain 128): ");
Serial.println(weightA128);
// Read from Channel A with Gain 128, can also try CHAN_A_GAIN_64 or CHAN_B_GAIN_32
int32_t weightB32 = hx711.readChannelBlocking(CHAN_B_GAIN_32);
Serial.print("Channel B (Gain 32): ");
Serial.println(weightB32);
}