Hello, I have a problem with my Sparkfun HX711.
I can't read the correct data from it unless it's connected to a I2C Port (SDA, SCL, on my Mega 2560 Port 20/21). The documentation says:
"The example code has DAT and CLK hooked up to pin 3 and 2 respectively, but this is easily changed in the code. Any GPIO pin will work for either."
For me, this isn't true. The problem is, my I2C Ports are already in use. Normally I would be able to use multiple I2C devices connected in row, but the HX711 has no I2C address, because it's no I2C device.
What can I do, where is my failure? Here's my current code, which only works with SDA/SCL:
#include "HX711.h"
#define DOUT 20 //SDA
#define CLK 21 //SCL
HX711 scale;
float calibration_factor = 2130;
void setup() {
Serial.begin(9600);
Serial.println("Remove all weight from scale");
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" g");
delay(500);
}
Also, here's the working circuit to the code: