QT-CART
This commit is contained in:
1 parent
e429161a89
commit
0c55b8f1aa
134 files changed
+6071
-5801
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from hx711 import HX711
|
||||
import json, time
|
||||
|
||||
DT_PIN = 5
|
||||
SCK_PIN = 6
|
||||
|
||||
with open("hx711_calib.json") as f:
|
||||
calib = json.load(f)
|
||||
|
||||
OFFSET = calib["offset"]
|
||||
SCALE = calib["scale"]
|
||||
|
||||
hx = HX711(DT_PIN, SCK_PIN)
|
||||
|
||||
hx.set_offset(OFFSET)
|
||||
hx.set_reference_unit(SCALE)
|
||||
|
||||
print(" 무게 측정 시작")
|
||||
|
||||
while True:
|
||||
weight = hx.get_weight(10)
|
||||
print(f"무게: {weight:.1f} g")
|
||||
time.sleep(0.5)
|
||||
Reference in new issue
Block a user