|
4 | 4 |
|
5 | 5 | # pylint: disable=import-error |
6 | 6 |
|
7 | | -""" |
8 | | -NeoPixel goggles code for CircuitPython |
9 | | -
|
10 | | -With a rotary encoder attached (pins are declred in the "Initialize |
11 | | -hardware" section of the code), you can select animation modes and |
12 | | -configurable attributes (color, brightness, etc.). TAP the encoder |
13 | | -button to switch between modes/settings, HOLD the encoder button to |
14 | | -toggle between PLAY and CONFIGURE states. |
15 | | -
|
16 | | -With no rotary encoder attached, you can select an animation mode |
17 | | -and configure attributes in the "Configurable defaults" section |
18 | | -(including an option to auto-cycle through the animation modes). |
19 | | -
|
20 | | -Things to Know: |
21 | | -- FancyLED library is NOT used here because it's a bit too much for the |
22 | | - Trinket M0 to handle (animation was very slow). |
23 | | -- Animation modes are all monochromatic (single color, varying only in |
24 | | - brightness). More a design decision than a technical one...of course |
25 | | - NeoPixels can be individual colors, but folks like customizing and the |
26 | | - monochromatic approach makes it easier to select a color. Also keeps the |
27 | | - code a bit simpler, since Trinket space & performance is limited. |
28 | | -- Animation is monotonic time driven; there are no sleep() calls. This |
29 | | - ensures that animation is constant-time regardless of the hardware or |
30 | | - CircuitPython performance over time, or other goings on (e.g. garbage |
31 | | - collection), only the frame rate (smoothness) varies; overall timing |
32 | | - remains consistent. |
33 | | -""" |
| 7 | + |
| 8 | +# NeoPixel goggles code for CircuitPython |
| 9 | +# |
| 10 | +# With a rotary encoder attached (pins are declred in the "Initialize |
| 11 | +# hardware" section of the code), you can select animation modes and |
| 12 | +# configurable attributes (color, brightness, etc.). TAP the encoder |
| 13 | +# button to switch between modes/settings, HOLD the encoder button to |
| 14 | +# toggle between PLAY and CONFIGURE states. |
| 15 | +# |
| 16 | +# With no rotary encoder attached, you can select an animation mode |
| 17 | +# and configure attributes in the "Configurable defaults" section |
| 18 | +# (including an option to auto-cycle through the animation modes). |
| 19 | +# |
| 20 | +# Things to Know: |
| 21 | +# - FancyLED library is NOT used here because it's a bit too much for the |
| 22 | +# Trinket M0 to handle (animation was very slow). |
| 23 | +# - Animation modes are all monochromatic (single color, varying only in |
| 24 | +# brightness). More a design decision than a technical one...of course |
| 25 | +# NeoPixels can be individual colors, but folks like customizing and the |
| 26 | +# monochromatic approach makes it easier to select a color. Also keeps the |
| 27 | +# code a bit simpler, since Trinket space & performance is limited. |
| 28 | +# - Animation is monotonic time driven; there are no sleep() calls. This |
| 29 | +# ensures that animation is constant-time regardless of the hardware or |
| 30 | +# CircuitPython performance over time, or other goings on (e.g. garbage |
| 31 | +# collection), only the frame rate (smoothness) varies; overall timing |
| 32 | +# remains consistent. |
34 | 33 |
|
35 | 34 | from math import modf, pi, sin |
36 | 35 | from random import getrandbits |
|
0 commit comments