how to use INPUT_PULLUP using pyfirmata2

943 Views Asked by At

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 to call INPUT_PULLUP, and if I run the program the output will be true and false.

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)
1

There are 1 best solutions below

0
On

I don't believe that pyfirmata supports pullup. You can try Telemetrix Telemetrix is similar to Firmata, but does not use 7bit bytes. You can view its API here. If you really need to use Firmata, then also look at pymata4.