|
1 | | -from adafruit_circuitplayground.express import cpx |
| 1 | +from adafruit_circuitplayground import cp |
2 | 2 |
|
3 | 3 | while True: |
4 | | - if cpx.switch: |
| 4 | + if cp.switch: |
5 | 5 | print("Slide switch off!") |
6 | | - cpx.pixels.fill((0, 0, 0)) |
7 | | - cpx.stop_tone() |
| 6 | + cp.pixels.fill((0, 0, 0)) |
| 7 | + cp.stop_tone() |
8 | 8 | continue |
9 | | - if cpx.touch_A4: |
| 9 | + if cp.touch_A4: |
10 | 10 | print('Touched A4!') |
11 | | - cpx.pixels.fill((15, 0, 0)) |
12 | | - cpx.start_tone(262) |
13 | | - elif cpx.touch_A5: |
| 11 | + cp.pixels.fill((15, 0, 0)) |
| 12 | + cp.start_tone(262) |
| 13 | + elif cp.touch_A5: |
14 | 14 | print('Touched A5!') |
15 | | - cpx.pixels.fill((15, 5, 0)) |
16 | | - cpx.start_tone(294) |
17 | | - elif cpx.touch_A6: |
| 15 | + cp.pixels.fill((15, 5, 0)) |
| 16 | + cp.start_tone(294) |
| 17 | + elif cp.touch_A6: |
18 | 18 | print('Touched A6!') |
19 | | - cpx.pixels.fill((15, 15, 0)) |
20 | | - cpx.start_tone(330) |
21 | | - elif cpx.touch_A7: |
| 19 | + cp.pixels.fill((15, 15, 0)) |
| 20 | + cp.start_tone(330) |
| 21 | + elif cp.touch_A7: |
22 | 22 | print('Touched A7!') |
23 | | - cpx.pixels.fill((0, 15, 0)) |
24 | | - cpx.start_tone(349) |
25 | | - elif cpx.touch_A1: |
| 23 | + cp.pixels.fill((0, 15, 0)) |
| 24 | + cp.start_tone(349) |
| 25 | + elif cp.touch_A1: |
26 | 26 | print('Touched A1!') |
27 | | - cpx.pixels.fill((0, 15, 15)) |
28 | | - cpx.start_tone(392) |
29 | | - elif cpx.touch_A2 and not cpx.touch_A3: |
| 27 | + cp.pixels.fill((0, 15, 15)) |
| 28 | + cp.start_tone(392) |
| 29 | + elif cp.touch_A2 and not cp.touch_A3: |
30 | 30 | print('Touched A2!') |
31 | | - cpx.pixels.fill((0, 0, 15)) |
32 | | - cpx.start_tone(440) |
33 | | - elif cpx.touch_A3 and not cpx.touch_A2: |
| 31 | + cp.pixels.fill((0, 0, 15)) |
| 32 | + cp.start_tone(440) |
| 33 | + elif cp.touch_A3 and not cp.touch_A2: |
34 | 34 | print('Touched A3!') |
35 | | - cpx.pixels.fill((5, 0, 15)) |
36 | | - cpx.start_tone(494) |
37 | | - elif cpx.touch_A2 and cpx.touch_A3: |
| 35 | + cp.pixels.fill((5, 0, 15)) |
| 36 | + cp.start_tone(494) |
| 37 | + elif cp.touch_A2 and cp.touch_A3: |
38 | 38 | print('Touched "8"!') |
39 | | - cpx.pixels.fill((15, 0, 15)) |
40 | | - cpx.start_tone(523) |
| 39 | + cp.pixels.fill((15, 0, 15)) |
| 40 | + cp.start_tone(523) |
41 | 41 | else: |
42 | | - cpx.pixels.fill((0, 0, 0)) |
43 | | - cpx.stop_tone() |
| 42 | + cp.pixels.fill((0, 0, 0)) |
| 43 | + cp.stop_tone() |
0 commit comments