Skip to content

Instantly share code, notes, and snippets.

@davipo
Forked from lesp/Dice Roll
Last active October 17, 2015 06:42
Show Gist options
  • Save davipo/50cdf1442af9d7ff5f74 to your computer and use it in GitHub Desktop.
Save davipo/50cdf1442af9d7ff5f74 to your computer and use it in GitHub Desktop.
Dice Roll
#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)
sleep(3)
# turn them off
for led in leds[:roll]:
GPIO.output(led, 0)
#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)
sleep(3)
# turn them off
for led in leds[:roll]:
GPIO.output(led, 0)
@davipo
Copy link
Author

davipo commented Oct 17, 2015

diceRoll.py is the same code with tabs changed to 4 spaces for good Python style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment