I am connecting a MH sensor to a digital pin (board arduino uno), want to read the digital value of this sensor using PYFIRMATA. this is the code t wrote :
import pyfirmata
board = pyfirmata.Arduino('COM6')
pin_number = 2
board.digital[2].mode = pyfirmata.INPUT
it = pyfirmata.util.Iterator(board)
it.start()
# Read the value of the sensor
sensor_value = board.digital[pin_number].read()
while True:
# Read the value of the sensor
sensor_value = board.digital[pin_number].read()
print(f"value: {sensor_value}")
I got the output as None instead of expected values(HIGH or LOW)