https://www.cnblogs.com/gooutlook/p/12516821.html
使用Arduino开发板连接HX711称重传感器模块制作数字体重秤 [复制链接]
https://item.taobao.com/item.htm?spm=a1z09.2.0.0.4c992e8deJNp96&id=575012000301&_u=i1qf7bf58a90
安装库
修改引脚
/** * * HX711 library for Arduino - example file * https://github.com/bogde/HX711 * * MIT License * (c) 2018 Bogdan Necula * **/ #include "HX711.h" // HX711 circuit wiring const int LOADCELL_DOUT_PIN = PB1; const int LOADCELL_SCK_PIN = PB10; HX711 scale; void setup() { Serial.begin(9600); scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); scale.set_scale(2280.f); // this value is obtained by calibrating the scale with known weights; see the README for details scale.tare(); // reset the scale to 0 } void loop() { Serial.print("one reading:\t"); Serial.print(scale.get_units(), 1); //1次数值 Serial.print("\t| average:\t"); Serial.println(scale.get_units(10), 1);//10次平均 scale.power_down(); // put the ADC in sleep mode delay(1000); scale.power_up(); }