Skip to content

Instantly share code, notes, and snippets.

@MrYsLab
Created February 13, 2016 20:56
Show Gist options
  • Save MrYsLab/4ed6c58755039d67881c to your computer and use it in GitHub Desktop.
Save MrYsLab/4ed6c58755039d67881c to your computer and use it in GitHub Desktop.
pymata-aio running 2 instance in one process
from pymata_aio.pymata3 import PyMata3
from pymata_aio.constants import Constants
switch = 12
board = PyMata3(com_port = '/dev/ttyACM0')
board2 = PyMata3(com_port = '/dev/ttyACM1')
def setup():
board.set_pin_mode(switch, Constants.INPUT)
board2.set_pin_mode(switch, Constants.INPUT)
# activate internal pullup
board2.digital_write(12, 1)
def loop():
x = board.digital_read(12)
y = board2.digital_read(12)
print(str(x) + " " + str(y))
if __name__ == "__main__":
setup()
while True:
loop()
board.sleep(.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment