Guest User

Untitled

a guest
Jul 8th, 2016
388
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Bibliothek einfügen
  2. import time
  3. import RPi.GPIO as GPIO
  4.  
  5.  
  6.  
  7. #Pin Nummern wie auf dem RPi verwenden
  8. #BCM für die GPIO Nummern
  9. #BOARD für die Pins zum abzählen
  10. GPIO.setmode(GPIO.BCM)
  11.  
  12. #Warnung entfernen. LOL
  13. GPIO.setwarnings(False)
  14.  
  15. #LEDs als Output setzen
  16. GPIO.setup(4, GPIO.OUT) # LED 1
  17. GPIO.setup(17, GPIO.OUT) # LED 2
  18. GPIO.setup(18, GPIO.OUT) # LED 3
  19. GPIO.setup(27, GPIO.OUT) # LED 4
  20. GPIO.setup(22, GPIO.OUT) # LED 5
  21. GPIO.setup(23, GPIO.OUT) # LED 6
  22. GPIO.setup(24, GPIO.OUT) # LED 7
  23. GPIO.setup(25, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
  24. #write (lednummer, 1/0) setzen
  25. def write(led, status):
  26. if (led == 1):
  27. GPIO.output(4, status)
  28. elif (led == 2):
  29. GPIO.output(17, status)
  30. elif (led == 3):
  31. GPIO.output(18, status)
  32. elif (led == 4):
  33. GPIO.output(27, status)
  34. elif (led == 5):
  35. GPIO.output(22, status)
  36. elif (led == 6):
  37. GPIO.output(23, status)
  38. elif (led == 7):
  39. GPIO.output(24, status)
  40.  
  41. #alles aus
  42. def aus():
  43. for x in range(1,8):
  44. write(x, False)
  45.  
  46. #Würfelseiten definieren
  47. def bild1():
  48. write(4,True)
  49.  
  50. def bild2():
  51. write(6, True)
  52. write(2, True)
  53.  
  54.  
  55. def bild3():
  56. write(6, True)
  57. write(2, True)
  58. write(4, True)
  59.  
  60. def bild4():
  61. write(1, True)
  62. write(2, True)
  63. write(6, True)
  64. write(7, True)
  65.  
  66.  
  67. def bild5():
  68. write(1, True)
  69. write(2, True)
  70. write(6, True)
  71. write(7, True)
  72. write(4, True)
  73.  
  74.  
  75. def bild6():
  76. write(1, True)
  77. write(2, True)
  78. write(3, True)
  79. write(5, True)
  80. write(6, True)
  81. write(7, True)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×