I'm using a load cell with a servo, but when putting them together the servo twitches every few seconds.
The following codes just simply insert a servo into the HX711_basic_example. With a shorter delay(300), the servo twitches every few seconds. With longer delay, the twitches are less frequent, but still persist.
include
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 4;
const int LOADCELL_SCK_PIN = 5;
I'm using a load cell with a servo, but when putting them together the servo twitches every few seconds.
The following codes just simply insert a servo into the HX711_basic_example. With a shorter delay(300), the servo twitches every few seconds. With longer delay, the twitches are less frequent, but still persist.
include
// HX711 circuit wiring const int LOADCELL_DOUT_PIN = 4; const int LOADCELL_SCK_PIN = 5;
HX711 scale;
include
const int servoPin = 9; Servo myServo;
void setup() { Serial.begin(57600); scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
myServo.attach(servoPin); myServo.write(90);
Serial.println("Starting..."); }
void loop() {
while (!scale.is_ready()) { Serial.print("skip "); } Serial.println("");
long reading = scale.read(); Serial.print("HX711 reading: "); Serial.println(reading);
delay(300);
myServo.write(180); }