Created
May 17, 2011 04:57
-
-
Save hgdeoro/975974 to your computer and use it in GitHub Desktop.
Test 74HC164 shift register with Py-Arduino-Proxy
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
# Test 74HC164 shift register | |
import time | |
from arduino_proxy import ArduinoProxy | |
def blink(): | |
print "blink()" | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, 0) | |
time.sleep(0.5) | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, 255) | |
time.sleep(0.5) | |
# Replace /dev/ttyACM0 with the device for your Arduino (it may be /dev/ttyACM1 or another) | |
proxy = ArduinoProxy('/dev/ttyACM0') | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, 0, | |
set_pin_mode=True) | |
blink() | |
blink() | |
blink() | |
for i in range(0, 256): | |
print i | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, i) | |
blink() | |
blink() | |
blink() | |
for i in range(255, -1, -1): | |
print i | |
proxy.shiftOut(10, 11, ArduinoProxy.LSBFIRST, i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment