Created
March 27, 2015 12:13
-
-
Save MrYsLab/aabc3e7391ebc7ffd96d to your computer and use it in GitHub Desktop.
Updated blink script with firmata reset at the end
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
import time | |
import sys | |
from PyMata.pymata import PyMata | |
# digital pin 13 is connected to an LED | |
BOARD_LED = 13 | |
# create a PyMata instance | |
firmata = PyMata("/dev/ttyATH0") | |
# set digital pin 13 to be an output port | |
firmata.set_pin_mode(BOARD_LED, firmata.OUTPUT, firmata.DIGITAL) | |
#time.sleep(5) | |
print("Blinking LED on pin 13") | |
# blink for 10 times | |
for x in range(10): | |
print(x + 1) | |
firmata.digital_write(BOARD_LED, 1) | |
# wait a half second between toggles. | |
time.sleep(.5) | |
firmata.digital_write(BOARD_LED, 0) | |
time.sleep(.5) | |
# reset firmata and let the serial port drain | |
firmata.reset | |
time.sleep(1) | |
# close PyMata when we are done | |
firmata.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment