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)