標(biāo)題:
Arduino HX711模塊庫(kù)文件下載
[打印本頁(yè)]
作者:
sh782945358
時(shí)間:
2019-6-10 00:05
標(biāo)題:
Arduino HX711模塊庫(kù)文件下載
有些亂,不過(guò)能看
0.png
(6.02 KB, 下載次數(shù): 104)
下載附件
2019-6-10 04:32 上傳
Arduino源程序如下:
#include "hx711.h"
long HX711_Buffer = 0;
long Weight_Maopi = 0,Weight_Shiwu = 0;
#define GapValue 430
//****************************************************
//初始化HX711
//****************************************************
void Init_Hx711()
{
pinMode(HX711_SCK, OUTPUT);
pinMode(HX711_DT, INPUT);
}
//****************************************************
//獲取毛皮重量
//****************************************************
void Get_Maopi()
{
Weight_Maopi = HX711_Read();
}
//****************************************************
//稱重
//****************************************************
long Get_Weight()
{
HX711_Buffer = HX711_Read();
Weight_Shiwu = HX711_Buffer;
Weight_Shiwu = Weight_Shiwu - Weight_Maopi; //獲取實(shí)物的AD采樣數(shù)值。
Weight_Shiwu = (long)((float)Weight_Shiwu/GapValue);
return Weight_Shiwu;
}
//****************************************************
//讀取HX711
//****************************************************
unsigned long HX711_Read(void) //增益128
{
unsigned long count;
unsigned char i;
bool Flag = 0;
digitalWrite(HX711_DT, HIGH);
delayMicroseconds(1);
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
count=0;
while(digitalRead(HX711_DT));
for(i=0;i<24;i++)
{
digitalWrite(HX711_SCK, HIGH);
delayMicroseconds(1);
count=count<<1;
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
if(digitalRead(HX711_DT))
count++;
}
digitalWrite(HX711_SCK, HIGH);
count ^= 0x800000;
delayMicroseconds(1);
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
return(count);
}
復(fù)制代碼
所有資料51hei提供下載:
HX711_AD.zip
(1.59 KB, 下載次數(shù): 103)
2019-6-10 00:05 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
大貓8888
時(shí)間:
2019-6-28 11:34
感謝
作者:
jt110112119
時(shí)間:
2021-3-20 11:00
thanks all
作者:
at58999
時(shí)間:
2022-3-21 22:11
大貓8888 發(fā)表于 2019-6-28 11:34
感謝
這個(gè)能用嗎
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1