diff --git a/CircuitPython_Sound_Box_2/code.py b/CircuitPython_Sound_Box_2/code.py old mode 100644 new mode 100755 index 56ca83069..a6698a0d6 --- a/CircuitPython_Sound_Box_2/code.py +++ b/CircuitPython_Sound_Box_2/code.py @@ -14,7 +14,7 @@ import adafruit_lis3dh from rainbowio import colorwheel -hue = 0 + # enable external power pin # provides power to the external components external_power = DigitalInOut(board.EXTERNAL_POWER) @@ -25,6 +25,10 @@ num_pixels = 24 pixels = neopixel.NeoPixel(board.EXTERNAL_NEOPIXELS, num_pixels, brightness=0.4, auto_write=True) +delta_hue = 256//num_pixels +speed = 10 # higher numbers = faster rainbow spinning +i=0 + # external button switch = keypad.Keys((board.EXTERNAL_BUTTON,), value_when_pressed=False, pull=True) @@ -58,7 +62,6 @@ num_shakes = len(shake_wavs) wav_index = 0 - def open_audio(num, wavs): n = wavs[num] f = open(n, "rb") @@ -83,7 +86,7 @@ def open_audio(num, wavs): pixels.fill(color['color']) else: pass - time.sleep(.7) + time.sleep(1) pixels.fill((0, 0, 0)) print('pressed') if event.released: @@ -91,10 +94,9 @@ def open_audio(num, wavs): if lis3dh.shake(shake_threshold=12): wave, wave_name = open_audio(random.randint(0, num_shakes - 1), shake_wavs) audio.play(wave) - for i in range(num_pixels): - pixels[i] = colorwheel(hue) - hue = (hue + 30) % 256 - print(hue) - time.sleep(.7) + for l in range(len(pixels)): + pixels[l] = colorwheel( int(i*speed + l * delta_hue) % 255 ) + pixels.show() + time.sleep(1) pixels.fill((0, 0, 0)) print('shake') diff --git a/CircuitPython_Sound_Box_2/wavs/AQUA Static Fizz.wav b/CircuitPython_Sound_Box_2/wavs/AQUA Static Fizz.wav deleted file mode 100644 index 9fb38c44e..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/AQUA Static Fizz.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/AQUA color.wav b/CircuitPython_Sound_Box_2/wavs/AQUA color.wav new file mode 100755 index 000000000..2ad1b2a63 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/AQUA color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/BLUE Electric Boom.wav b/CircuitPython_Sound_Box_2/wavs/BLUE Electric Boom.wav deleted file mode 100644 index e23086135..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/BLUE Electric Boom.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/BLUE color.wav b/CircuitPython_Sound_Box_2/wavs/BLUE color.wav new file mode 100755 index 000000000..22e946d85 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/BLUE color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/GREEN Pulse Wave.wav b/CircuitPython_Sound_Box_2/wavs/GREEN Pulse Wave.wav deleted file mode 100644 index 37d61f257..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/GREEN Pulse Wave.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/GREEN color.wav b/CircuitPython_Sound_Box_2/wavs/GREEN color.wav new file mode 100755 index 000000000..4b68d9f7f Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/GREEN color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/ORANGE Warp Implode.wav b/CircuitPython_Sound_Box_2/wavs/ORANGE Warp Implode.wav deleted file mode 100644 index 2d00dd4d2..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/ORANGE Warp Implode.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/ORANGE color.wav b/CircuitPython_Sound_Box_2/wavs/ORANGE color.wav new file mode 100755 index 000000000..a58329802 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/ORANGE color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/PINK Sonic Glitch.wav b/CircuitPython_Sound_Box_2/wavs/PINK Sonic Glitch.wav deleted file mode 100644 index 4c9ad046f..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/PINK Sonic Glitch.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/PINK color.wav b/CircuitPython_Sound_Box_2/wavs/PINK color.wav new file mode 100755 index 000000000..8d2b250a9 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/PINK color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/PURPLE Static Spark.wav b/CircuitPython_Sound_Box_2/wavs/PURPLE Static Spark.wav deleted file mode 100644 index b526ca945..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/PURPLE Static Spark.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/PURPLE color.wav b/CircuitPython_Sound_Box_2/wavs/PURPLE color.wav new file mode 100755 index 000000000..3df62a26c Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/PURPLE color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/RED Blast Charge.wav b/CircuitPython_Sound_Box_2/wavs/RED Blast Charge.wav deleted file mode 100644 index c12124e20..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/RED Blast Charge.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/RED color.wav b/CircuitPython_Sound_Box_2/wavs/RED color.wav new file mode 100755 index 000000000..ca19cb81c Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/RED color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/SHAKE Zap Shock.wav b/CircuitPython_Sound_Box_2/wavs/SHAKE Zap Shock.wav deleted file mode 100644 index e87188082..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/SHAKE Zap Shock.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/SHAKE adabot.wav b/CircuitPython_Sound_Box_2/wavs/SHAKE adabot.wav new file mode 100755 index 000000000..cdff423be Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/SHAKE adabot.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/SHAKE excellent.wav b/CircuitPython_Sound_Box_2/wavs/SHAKE excellent.wav new file mode 100755 index 000000000..9fda38e28 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/SHAKE excellent.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/SHAKE what.wav b/CircuitPython_Sound_Box_2/wavs/SHAKE what.wav new file mode 100755 index 000000000..be9c181a6 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/SHAKE what.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/WHITE Wobble Wave.wav b/CircuitPython_Sound_Box_2/wavs/WHITE Wobble Wave.wav deleted file mode 100644 index fc05217cb..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/WHITE Wobble Wave.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/WHITE color.wav b/CircuitPython_Sound_Box_2/wavs/WHITE color.wav new file mode 100755 index 000000000..fd631d381 Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/WHITE color.wav differ diff --git a/CircuitPython_Sound_Box_2/wavs/YELLOW Signal Drop.wav b/CircuitPython_Sound_Box_2/wavs/YELLOW Signal Drop.wav deleted file mode 100644 index 069c1ce04..000000000 Binary files a/CircuitPython_Sound_Box_2/wavs/YELLOW Signal Drop.wav and /dev/null differ diff --git a/CircuitPython_Sound_Box_2/wavs/YELLOW color.wav b/CircuitPython_Sound_Box_2/wavs/YELLOW color.wav new file mode 100755 index 000000000..bed9ee8ef Binary files /dev/null and b/CircuitPython_Sound_Box_2/wavs/YELLOW color.wav differ