This file contains hidden or 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
GPIO.setup(r13,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(r39,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(r67,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(r72,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(s38,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(s47,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(s68,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) | |
GPIO.setup(s99,GPIO.IN, pull_up_down = GPIO.PUD_DOWN) |
This file contains hidden or 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
#Function to roll dice | |
def dice(): | |
roll = randint(1,6) | |
print(roll) | |
leds = [d1, d2, d3, d4, d5, d6] | |
# turn on the number of LEDs specified by roll | |
for led in leds[:roll]: | |
GPIO.output(led, 1) | |