Skip to content

Instantly share code, notes, and snippets.

@Oliviercreativ
Last active February 18, 2016 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oliviercreativ/9e05d56acb25c5ef4386 to your computer and use it in GitHub Desktop.
Save Oliviercreativ/9e05d56acb25c5ef4386 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import random
lines = open('files.txt').read().splitlines()
myline =random.choice(lines)
print(myline)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
while True:
GPIO.output(25, GPIO.HIGH)
player1 = GPIO.input(24)
if (player1 == True ):
print("Joueur 1")
GPIO.output(25, GPIO.LOW)
time.sleep(.3)
GPIO.output(18, GPIO.HIGH)
player2 = GPIO.input(23)
if (player2 == True ):
print("Joueur 2")
GPIO.output(18, GPIO.LOW)
time.sleep(.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment