Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def play_tone(self, pitch, duration):
  2. pitch, duration = float(pitch), float(duration)
  3.  
  4. if pitch == 0:
  5. time.sleep(duration)
  6. return
  7.  
  8. p = GPIO.PWM(self.pin, pitch)
  9. p.start(0.5)
  10. time.sleep(duration)
  11. p.stop()
  12.  
  13. def play(self, tune):
  14. for pitch, duration in tune:
  15. self.play_tone(pitch, duration)
  16.  
  17. (gdb) bt
  18. #0 0x764dac54 in output_gpio () from /usr/lib/python3/dist-packages/RPi/_GPIO.cpython-35m-arm-linux-gnueabihf.so
  19. #1 0x764dc9bc in pwm_thread () from /usr/lib/python3/dist-packages/RPi/_GPIO.cpython-35m-arm-linux-gnueabihf.so
  20. #2 0x00001000 in ?? ()
  21. Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  22. (gdb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement