Browse Source

working gemma + stick

Brennen Bearnes 2 years ago
parent
commit
8a64fef987
4 changed files with 27 additions and 9 deletions
  1. 10
    5
      Makefile
  2. 7
    2
      README.md
  3. 8
    2
      stick.py
  4. 2
    0
      wzrd.py

+ 10
- 5
Makefile View File

@@ -1,12 +1,17 @@
1
+target = /media/brennen/CIRCUITPY
2
+
1 3
 # wizard staff rings
2 4
 ring:
3
-	cp rings.py /media/brennen/CIRCUITPY/main.py
4
-	cp blinkenring.py /media/brennen/CIRCUITPY/
5
+	cp rings.py $(target)/main.py
6
+	cp blinkenring.py $(target)
7
+	if [ -d $(target)/lib ]; then rm -r $(target)/lib
8
+	cp -r lib $(target)
5 9
 	sync
6 10
 
7 11
 # little 8-pixel stick
8 12
 stick:
9
-	cp stick.py /media/brennen/CIRCUITPY/main.py
10
-	cp blinkenring.py /media/brennen/CIRCUITPY/
11
-	cp -r gemma_lib /media/brennen/CIRCUITPY/lib
13
+	cp stick.py $(target)/main.py
14
+	cp blinkenring.py $(target)
15
+	if [ -d $(target)/lib ]; then rm -r $(target)/lib; fi
16
+	cp -r gemma_lib $(target)/lib
12 17
 	sync

+ 7
- 2
README.md View File

@@ -4,17 +4,21 @@ wzrd.py: a circuit playground express wizard staff
4 4
 I am really just fumbling around with Adafruit's
5 5
 [CircuitPython][circuitpython], a fork of [MicroPython][micropython].
6 6
 
7
-This code targets the [Circuit Playground Express][playground], which I am
7
+This code targets:
8
+
9
+- The [Circuit Playground Express][playground], which I am
8 10
 affixing to a staff I found in a corner of a converted garage I shared with
9 11
 [Living Arts Floral][livingarts] for a few years.  (Need flowers in the Lyons,
10 12
 CO area?  You can't go wrong with Jeralyn - tell her I sent you.)
13
+- The Gemma M0
11 14
 
12 15
 I have no idea what I am doing.
13 16
 
14 17
 dependencies
15 18
 ------------
16 19
 
17
-* [Circuit Playground Express][playground]
20
+* [Adafruit Circuit Playground Express][playground]
21
+* [Adafruit Gemma M0][gemma]
18 22
 * [Adafruit NeoPixel Ring - 24 x 5050 RGB LED](https://www.adafruit.com/product/1586)
19 23
 * [Adafruit_CircuitPython_Bundle][bundle] for various libraries
20 24
 
@@ -35,3 +39,4 @@ going with the MIT License.
35 39
 [playground]: https://www.adafruit.com/product/3333
36 40
 [livingarts]: http://livingartsfloral.com/
37 41
 [bundle]: https://github.com/adafruit/Adafruit_CircuitPython_Bundle
42
+[gemma]: https://www.adafruit.com/product/3501

+ 8
- 2
stick.py View File

@@ -1,10 +1,16 @@
1
-import board
1
+import analogio
2 2
 import blinkenring
3
+import board
3 4
 import dotstar
4 5
 import neopixel
5 6
 import time
7
+import urandom
6 8
 
9
+random_pin = analogio.AnalogIn(board.A1)
10
+urandom.seed(random_pin.value)
7 11
 stick = blinkenring.BlinkenRing(board.D0, 8, 4)
12
+stick.increment = -1
8 13
 while True:
14
+    # stick.party_mode = True
9 15
     stick.animate()
10
-    time.sleep(0.5)
16
+    time.sleep(0.2)

+ 2
- 0
wzrd.py View File

@@ -1,3 +1,5 @@
1
+# Some utility functions.
2
+
1 3
 def get_color_for_temp(temp_current):
2 4
     # i can't think in degrees celsius to save my life
3 5
     temp_cold = 5

Loading…
Cancel
Save