Autoformat 3D print NeoPixel Hair Dress
MODIFY
3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py
3D_Printed_NeoPixel_Ring_Hair_Dress/3D_Printed_NeoPixel_Ring_Hair_Dress.py
@@ -29,19 +29,22 @@ ACT_SPARKLING_RING = 0x20 # sparkling effect
numpix = 16 # total number of NeoPixels
pixel_output = board.D0 # pin where NeoPixels are connected
analog_input = board.A0 # needed to seed the random generator
-strip = neopixel.NeoPixel(pixel_output, numpix, brightness=.3, auto_write=False)
+strip = neopixel.NeoPixel(pixel_output, numpix,
+ brightness=.3, auto_write=False)
# available color generation methods
COL_RANDOM = 0x40 # colors will be generated randomly
COL_SPECTRUM = 0x80 # colors will be set as cyclic spectral wipe
# specifiyng the action list
-action_duration = 0 # the action's overall duration in milliseconds (be careful not
+# the action's overall duration in milliseconds (be careful not
+action_duration = 0
# to use values > 2^16-1 - roughly one minute :-)
action_and_color_gen = 1 # the color generation method
-action_step_duration = 2 # the duration of each action step rsp. the delay of the main
+# the duration of each action step rsp. the delay of the main
+action_step_duration = 2
# loop in milliseconds - thus, controls the action speed (be
# careful not to use values > 2^16-1 - roughly one minute :-)
@@ -50,7 +53,8 @@ color_granularity = 3 # controls the increment of the R, G, and B portions
# the increment is 0,10,20,... don't use values > 255, and note
# that even values > 127 wouldn't make much sense...
-color_interval = 4 # controls the speed of color changing independently from action
+# controls the speed of color changing independently from action
+color_interval = 4
# general global variables
color = 0
@@ -93,34 +97,60 @@ spectrum_part = 0
# duration color generation method duration granularity interval
theactionlist = [
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2, ACT_CYCLING_RING_CLKW | COL_RANDOM, 0.02, 1, 0.005 ],
+ [2, ACT_CYCLING_RING_CLKW | COL_RANDOM,
+ 0.02, 1, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2, ACT_CYCLING_RING_ACLK | COL_RANDOM, 0.02, 1, 0.005 ],
+ [2, ACT_CYCLING_RING_ACLK | COL_RANDOM,
+ 0.02, 1, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2.5, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.25, 20, 0.020 ],
- [ 1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.50, 1, 0.020 ],
- [ .750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.075, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.100, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.125, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.150, 1, 0.050 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.175, 1, 0.100 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.200, 1, 0.200 ],
- [ .750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.225, 1, 0.250 ],
- [ 1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.250, 1, 0.350 ],
- [ 30, ACT_SIMPLE_RING | COL_SPECTRUM, 0.050, 1, 0.010 ],
- [ 2.5, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.010, 1, 0.010 ],
- [ 2.5, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.015, 1, 0.020 ],
- [ 2, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.025, 1, 0.030 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.050, 1, 0.040 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.075, 1, 0.040 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.100, 1, 0.050 ],
- [ .500, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.125, 1, 0.060 ],
- [ .500, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.125, 5, 0.050 ],
- [ 1, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.100, 10, 0.040 ],
- [ 1.5, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.075, 15, 0.030 ],
- [ 2, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.050, 20, 0.020 ],
- [ 2.5, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.025, 25, 0.010 ],
- [ 3, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.010, 30, 0.005 ],
+ [2.5, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.25, 20, 0.020],
+ [1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.50, 1, 0.020],
+ [.750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.075, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.100, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.125, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.150, 1, 0.050],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.175, 1, 0.100],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.200, 1, 0.200],
+ [.750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.225, 1, 0.250],
+ [1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.250, 1, 0.350],
+ [30, ACT_SIMPLE_RING | COL_SPECTRUM,
+ 0.050, 1, 0.010],
+ [2.5, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.010, 1, 0.010],
+ [2.5, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.015, 1, 0.020],
+ [2, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.025, 1, 0.030],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.050, 1, 0.040],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.075, 1, 0.040],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.100, 1, 0.050],
+ [.500, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.125, 1, 0.060],
+ [.500, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.125, 5, 0.050],
+ [1, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.100, 10, 0.040],
+ [1.5, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.075, 15, 0.030],
+ [2, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.050, 20, 0.020],
+ [2.5, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.025, 25, 0.010],
+ [3, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.010, 30, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.010, 25, 1],
[5, ACT_NOP, 0, 0, 0]
]
@@ -153,6 +183,7 @@ def nextspectrumcolor():
spectrum_part = 1
color_idx = 0
+
def nextrandomcolor():
global color
@@ -170,6 +201,7 @@ def nextrandomcolor():
color = (random_red, random_green, random_blue)
+
def nextcolor():
# save some RAM for more animation actions
if (curr_color_gen & COL_RANDOM):
@@ -177,6 +209,7 @@ def nextcolor():
else:
nextspectrumcolor()
+
def setup():
# fingers corssed, the seeding makes sense to really get random colors...
@@ -188,6 +221,7 @@ def setup():
nextcolor()
strip.write()
+
setup()
while True: # Loop forever...

Autoformat 3D print NeoPixel Hair Dress