code.py
 1  # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  from adafruit_circuitplayground.express import cpx
 6  
 7  # Set to check for single-taps.
 8  cpx.detect_taps = 1
 9  tap_count = 0
10  
11  # We're looking for 2 single-taps before moving on.
12  while tap_count < 2:
13      if cpx.tapped:
14          print("Single-tap!")
15          tap_count += 1
16  print("Reached 2 single-taps!")
17  
18  # Now switch to checking for double-taps.
19  tap_count = 0
20  cpx.detect_taps = 2
21  
22  # We're looking for 2 double-taps before moving on.
23  while tap_count < 2:
24      if cpx.tapped:
25          print("Double-tap!")
26          tap_count += 1
27  
28  print("Reached 2 double-taps!")
29  cpx.red_led = True
30  print("Done.")