Anyleaf pH传感器驱动器

anyleaf的Python项目详细描述


image

任意叶

用于Python中的AnyLeaf pH和RTD传感器

Homepage

快速启动

要尽快开始,请从终端运行以下命令:

  • sudo apt install python3-scipy
  • pip3 install anyleaf
  • git clone https://github.com/anyleaf/anyleaf-python.git
  • cd ph-python/examples
  • python3 ph_orp.py

终端机将显示pH值读数。在

要安装anyleafPython包,请运行pip3 install anyleaf,或者 pip install anyleaf,这取决于{}在操作系统上的设置方式。在

例如,对于Raspberry Pi和CircuitPython板:

importtimeimportboardimportbusiofromanyleafimportPhSensor,CalPt,CalSlot,OnBoard,OffBoarddefmain():i2c=busio.I2C(board.SCL,board.SDA)delay=1# Time between measurements, in secondsph_sensor=PhSensor(i2c,delay)# 2 or 3 pt calibration both give acceptable results.# Calibrate with known values. (voltage, pH, temp in °C).# You can find voltage and temperature with `ph_sensor.read_voltage()` and # `ph_sensor.read_temp()` respectively.# For 3 pt calibration, pass a third argument to `calibrate_all`.ph_sensor.calibrate_all(CalPt(0.,7.,25.),CalPt(0.17,4.,25.))# Or, call these with the sensor in the appropriate buffer solution.# This will automatically use voltage and temperature.# Voltage and Temp are returned, but calibration occurs# without using the return values.# V, T = ph_sensor.calibrate(CalSlot.ONE, 7., Offboard(40.))# ph_sensor.calibrate(CalSlot.TWO, 4., OnBoard())# Store the calibration parameters somewhere, so they persist# between program runs.whileTrue:pH=ph_sensor.read(OnBoard())# To use an offboard temperature measurement: `ph_sensor.read(OffBoard(30.))`print(f"pH: {pH}")time.sleep(delay)if__name__=="__main__":main()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何拆分字符串(基于各种分隔符),但不保留空格?   解析。Json格式的txt文件和knime中的java   java Spring rest api为什么在rest api调用的响应中更改了数据类型   升华文本3抛出java。lang.ClassNotFoundException,而记事本++不存在   java Android指纹扫描仪在尝试5次后停止工作?   java Android如何设置精确的重复报警?   java如何使用HTTPGET connect为access API输入用户名和密码   java当测试报告显示没有测试失败时,Gradle为什么说“有失败的测试”?   用Gson实现java获取响应   MapReduce程序中函数错误的java不可映射参数   java spring安全性不符合自动代理的条件   java GWT使用异步回调进行同步/阻塞调用   java奇怪的类数组问题无法在jsp中显示   如何在java中使用PrinterJob使用epl打印条形码   java如何在JTable中居中单元格   将Java Mockito测试转换为Kotlin   html Java正则表达式模式匹配到多个相同标记   testCompile中缺少java Gradle(Android)多项目依赖项   在输入提示后输入字符串时发生java FileNotFoundException