diff --git a/examples/blink.py b/examples/blink.py index 24eea2f..b93ba74 100644 --- a/examples/blink.py +++ b/examples/blink.py @@ -11,15 +11,40 @@ from pymata_aio.pymata3 import PyMata3 from pymata_aio.constants import Constants +# Arduino LED is on pin 13 BOARD_LED = 13 + +# If you are having problems connecting, you may +# wish to add some time the arduino_wait parameter. + +# replace: +# board = PyMata3() +# with: +# board = PyMata3(arduino_wait=5) + +# adjust the arduino_wait value to meet the needs +# of your computer + +# instantiate PyMata3 board = PyMata3() def setup(): + """ + Set the Arduino BOARD_LED pin as an output + :return: + """ board.set_pin_mode(BOARD_LED, Constants.OUTPUT) def loop(): + """ + Toggle the LED by alternating the values written + to the LED pin. Wait 1 second between writes. + Also note the use of board.sleep and not + time.sleep. + :return: + """ print("LED On") board.digital_write(BOARD_LED, 1) board.sleep(1.0)