I have connected pin D2 on my arduino nano to high, and tried it out with an arduino c program and it works. However, when I load standard firmata onto the the controller from the arduino IDE and try the following python program:
import pyfirmata board = pyfirmata.Arduino('/dev/ttyUSB0') for x in range(2,14): print("%s %s" % (x, board.get_pin("d:%s:i" % x).read()))
I get this:
$ venv/bin/python test.py 2 None 3 None 4 None 5 None 6 None 7 None 8 None 9 None 10 None 11 None 12 None 13 None
I can write digital pins with fermata and pyfirmata, but I can't read.
I have also tried this:
import pyfirmata board.digital.mode = pyfirmata.INPUT board.digital.mode = pyfirmata.INPUT for x in range(2,14): print("%s %s" % (x, board.digital[x].read()))
and other combinations, and always get None
(disconnecting the wire in the picture doesn't change anything either)
I have also just repeated the experiment with an arduino uno and get the same result
so I guess my questions are:
- Can anybody spot anything obvious that I am doing wrong?
- Can anybody confirm that pyfirmata input ever works?
- What did you do that I am not doing?