/ examples / circuitplayground_play_file_buttons.py
circuitplayground_play_file_buttons.py
 1  """THIS EXAMPLE REQUIRES A WAV FILE FROM THE examples FOLDER IN THE
 2  Adafruit_CircuitPython_CircuitPlayground REPO found at:
 3  https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/tree/master/examples
 4  
 5  Copy the "dip.wav" and "rise.wav" files to your CIRCUITPY drive.
 6  
 7  Once the files are copied, this example plays a different wav file for each button pressed!"""
 8  from adafruit_circuitplayground.express import cpx
 9  
10  while True:
11      if cpx.button_a:
12          cpx.play_file("dip.wav")
13      if cpx.button_b:
14          cpx.play_file("rise.wav")