【Arduino】HX711 拉力计称重模块 两个模块同时使用

硬件

hx711模块使用原理图如下:
在这里插入图片描述

应变片原理

在这里插入图片描述
图片来源

程序

使用此测试程序需要先下载 HX711 库文件。
下载方法:在“工具”—>“管理库”中,搜索“hx711”,并安装图示的库文件。
在这里插入图片描述

拉力计模块测试程序:

/******************************************************************
* 程序名称:拉力计模块 HX711 使用
* 程序功能:显示模块读取到的数值
* 程序版本:Ver 1.0
* 编写日期:2020/07/30
* 作者信息:天津科技大学创新实验室-JC
******************************************************************/
#include <Q2HX711.h>

const byte hx711_data_pin = 48;
const byte hx711_clock_pin = 47;

Q2HX711 hx711(hx711_data_pin, hx711_clock_pin);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(hx711.read()/100.0);
  delay(500);
}

两个拉力计模块同时使用程序:

/******************************************************************
* 程序名称:拉力计模块 HX711 使用
* 程序功能:同时读取两个模块的数值
* 程序版本:Ver 1.0
* 编写日期:2020/07/30
* 作者信息:天津科技大学创新实验室-JC
******************************************************************/
#include <Q2HX711.h>

const byte hx711_data_pin = 48;
const byte hx711_clock_pin = 47;

const byte hx712_data_pin = 52;
const byte hx712_clock_pin = 50;

Q2HX711 hx711(hx711_data_pin, hx711_clock_pin);

Q2HX711 hx712(hx712_data_pin, hx712_clock_pin);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.print("hx711 Value:");
  Serial.println(hx711.read()/100.0);
  Serial.print("hx712 Value:");
  Serial.println(hx712.read()/100.0);
  delay(500);
}
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Zhao-Jichao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值