简体   繁体   English

如何在Python中使用HX711.h库?

[英]How to use the HX711.h library with Python?

I'am using a balance sensor with a HX711 amplifier. 我正在将平衡传感器与HX711放大器配合使用。 Including the HX711.h library in Arduino IDE, which leads to getting the weight in the real time. 在Arduino IDE中包括HX711.h库,可实时获取权重。 This works well. 这很好。

But in my case, I'am working on python and the package Pyfirmata (which provides the communication with the Arduino Board). 但就我而言,我正在研究python和Pyfirmata软件包(该软件包提供与Arduino开发板的通信)。 So I want to know how to include the HX711.h library in my python code. 所以我想知道如何在我的python代码中包含HX711.h库。

Whats up! 这是怎么回事! First you can't use a .h with python (only c/c++) you must look a .py library, you may need learn python. 首先,您不能将.h与python一起使用(仅限c / c ++),而必须使用.py库,您可能需要学习python。 So i search and i found this: 所以我搜索,发现了这个:

https://github.com/learn2develop/hx711py https://github.com/learn2develop/hx711py

https://pypi.org/project/hx711/ (maybe this one is only for Rasp) https://pypi.org/project/hx711/ (也许这仅适用于Rasp)

One more thing use python to program a microcontroller or a Arduino is not a good choise. 使用python对微控制器或Arduino编程的另一件事不是一个好选择。 Learn c++ and you will make programs to a AVR,PIC,ST32.... 学习c ++,您将制作AVR,PIC,ST32程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM