SHARE
TWEET

soundbox rpi 3 pygame wahlschalter

disast3r-76 Feb 27th, 2020 78 in 334 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pygame
  2. from gpiozero import Button
  3.  
  4. pygame.init()
  5.  
  6. drum = pygame.mixer.Sound('/home/pi/musicbox/match0.wav')
  7. cymbal = pygame.mixer.Sound('/home/pi/musicbox/match1.wav')
  8. snare = pygame.mixer.Sound('/home/pi/musicbox/match2.wav')
  9. bell = pygame.mixer.Sound('/home/pi/musicbox/match3.wav')
  10.  
  11. btn_drum = Button(17)
  12. btn_cybal = Button(27)
  13. wahl1 = Button(10)
  14. taste1 = Button(22)
  15.  
  16.  
  17. btn_drum.when_pressed = drum.play
  18. btn_cybal.when_pressed = cymbal.play
  19.  
  20. if pressed Button(10):
  21.     taste1.when_pressed = bell.play
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top