Skip to content

Instantly share code, notes, and snippets.

@MrYsLab
Created June 13, 2018 23:12
Show Gist options
  • Save MrYsLab/38bd302f50ef0f1ed77b90166ca485d2 to your computer and use it in GitHub Desktop.
Save MrYsLab/38bd302f50ef0f1ed77b90166ca485d2 to your computer and use it in GitHub Desktop.
three_analog.py
from pymata_aio.pymata3 import PyMata3
from pymata_aio.constants import Constants
board = PyMata3(2)
pins = [0, 1, 2]
# set pin mode for analog pins 0 - 2
for pin in pins:
board.set_pin_mode(pin, Constants.ANALOG)
while True:
for pin in pins:
data = board.analog_read(pin)
# if you need a short delay - set to value that works for your hardware
# board.sleep(.1)
print(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment