-
-
Save MrYsLab/8b735813e413bf62b455 to your computer and use it in GitHub Desktop.
pymata_aio_pymata3_example
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
#!/usr/bin/env python3 | |
from pymata_aio.pymata3 import PyMata3 | |
from pymata_aio.constants import Constants | |
def pin_6_pwm_128(): | |
""" | |
Set digital pin 6 as a PWM output and set its output value to 128 | |
@return: No Value Returned. | |
""" | |
# instantiate the pymata_core API | |
board = PyMata3() | |
# set the pin mode | |
board.set_pin_mode(6, Constants.PWM) | |
board.analog_write(6, 128) | |
# wait for 3 seconds to see the LED lit | |
board.sleep(3) | |
# reset the board and exit | |
board.shutdown() | |
if __name__ == "__main__": | |
pin_6_pwm_128() |
board = PyMata3(com_port='/dev/ttyACM0')
See details.
If you don't specify the port (leaving the default as com_port-None
), then it will be automatically detected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do you set the com port the arduino is located on?