-
-
Save MrYsLab/4ed6c58755039d67881c to your computer and use it in GitHub Desktop.
pymata-aio running 2 instance in one process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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