我正在尝试建立一个带有20公斤称重传感器的秤,以测试火箭发动机的功率。我正在使用这些步骤来构建它,当我运行余额程序时,它给了我这个错误。是的,我已经安装了该库。
exit status 1
no matching function for call to 'HX711::HX711(int, int)'
这是代码
/* Calibration sketch for HX711 */
#include "HX711.h" // Library needed to communicate with HX711 https://github.com/bogde/HX711
#define DOUT 6 // Arduino pin 6 connect to HX711 DOUT
#define CLK 5 // Arduino pin 5 connect to HX711 CLK
HX711 scale(DOUT, CLK); // Init of library
void setup() {
Serial.begin(9600);
scale.set_scale(); // Start scale
scale.tare(); // Reset scale to zero
}
void loop() {
float current_weight=scale.get_units(20); // get average of 20 scale readings
float scale_factor=(current_weight/0.145); // divide the result by a known weight
Serial.println(scale_factor); // Print the scale factor to use
}
希望获得帮助,这是网站https://www.brainy-bits.com/load-cell-and-hx711-with-arduino/
的链接答案 0 :(得分:0)
尝试将HX711 scale(DOUT, CLK);
替换为HX711 scale;
,然后在void setup()的开头添加scale.begin(DOUT, CLK);