Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyfirmata
- PORT = "/dev/ttyACM0"
- board = pyfirmata.Arduino(PORT)
- PINS = (0, 1, 2, 3)
- it = pyfirmata.util.Iterator(board)
- it.start()
- for pin in PINS:
- board.analog[pin].enable_reporting()
- pin2 = board.get_pin('d:2:o')
- val = board.analog[0].read()
- board.pass_time(1)
- while True:
- val = board.analog[0].read()
- print val
- if val >= .50:
- pin2.write(1)
- else:
- pin2.write(0)
- board.pass_time(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement