These are some exercises you can try if you have time to spare. For each exercise, run the code and try to adapt it.

Capacitive touch

Each of the copper pads at the edge of the board can act as capacitive touch detectors (i.e., a simple version of your phone’s touchscreen). It might be a bit difficult to touch a single pad with your fingers. If you want you can attach an alligator clip to the pad(s).

Untitled

The code below detects whether pad A1 is touched. If so, it switches on an LED.

import time
import board
import touchio
import neopixel

#You may need to restart your code/board after changing the attached item because 
# the capacitive touch code 'calibrates' based on what it sees when it first starts up.
 
touch_A1 = touchio.TouchIn(board.A1)
touch_A2 = touchio.TouchIn(board.A2)
touch_A3 = touchio.TouchIn(board.A3)
touch_A4 = touchio.TouchIn(board.A4)
touch_A5 = touchio.TouchIn(board.A5)
touch_A6 = touchio.TouchIn(board.A6)
touch_TX = touchio.TouchIn(board.TX)
 
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)

while True:
    if touch_A1.value:
        print("A1 touched!")
        pixels[0] = (250, 0, 0)
    else:
        pixels[0] = (0, 0, 0)

    pixels.show()
    time.sleep(0.01)

Things to try

Glow

The code below makes the LEDs pulse. Shaking the device increases the pulse rate. When the board is not moving the pulse rate decreases gradually to the base rate.

Things to try

The code defines multiple parameters (variables):

  1. max_freq = 30 → Maximum pulse frequency
  2. min_freq = 0.5 → Base rate (minimum) pulse frequency
  3. leak_rate = 0.01 → Determines how fast the pulse rate “relaxes” to the base rate
  4. acceleration_threshold = 250 → Determines how hard you need to shake to increase pulse rate
  5. activation = 0.025 → Determines how fast the pulse rate increases when shaken