[英]how to use INPUT_PULLUP using pyfirmata2
In Arduino IDE (C++ programming language) we can use pinMode(button, INPUT_PULLUP)
to avoid using resistor, but here I'm using Arduino microcontroller and running StandardFirmata
inside it, then I use python and pyfirmata
library but I don't know how調用INPUT_PULLUP
,如果我運行程序 output 將是真假。
from pyfirmata2 import Arduino, util
import time
board = Arduino('COM6')
iterator = util.Iterator(board)
iterator.start()
button = board.get_pin('d:2:i')
while True:
print(button.read())
time.sleep(1)
我不相信 pyfirmata 支持上拉。 你可以試試Telemetrix Telemetrix 類似於 Firmata,但不使用 7bit 字節。 您可以在此處查看其 API。 如果你真的需要使用Firmata,那么還要看看pymata4。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.