Skip to content

Commit 7adec62

Browse files
author
ladyada
committed
Merge branch 'master' of github.com:ladyada/Adafruit_Learning_System_Guides
2 parents 2b0f7bc + 18a797f commit 7adec62

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

CLUE_Dice_Roller/clue_dice_roller.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,30 @@
3232
button_a = Debouncer(lambda: clue.button_a)
3333
button_b = Debouncer(lambda: clue.button_b)
3434

35-
3635
# Set up display
3736

38-
display = board.DISPLAY
39-
selection_font = bitmap_font.load_font('/Helvetica-Bold-36.bdf')
40-
selection_font.load_glyphs(b'0123456789XDd')
41-
selection_color = 0x0000FF
37+
select_font = bitmap_font.load_font('/Helvetica-Bold-36.bdf')
38+
select_font.load_glyphs(b'0123456789XDd')
39+
select_color = 0x0000FF
4240

4341
roll_font = bitmap_font.load_font('/Anton-Regular-104.bdf')
44-
roll_font.load_glyphs(b'0123456789XDd')
42+
roll_font.load_glyphs(b'0123456789X')
4543
roll_color = 0xFFFFFF
4644

47-
selection_label = label.Label(selection_font, x=0, y=25, text='XdXXX', color=selection_color)
45+
select_label = label.Label(select_font, x=0, y=25, text='XdXXX', color=select_color)
4846
roll_label = label.Label(roll_font, x=0, y=150, text='XXX', color=roll_color)
4947

5048
group = displayio.Group()
51-
group.append(selection_label)
49+
group.append(select_label)
5250
group.append(roll_label)
5351

54-
display.show(group)
52+
board.DISPLAY.show(group)
5553

5654
# Helper functions
5755

5856
def roll(count, sides):
5957
for i in range(15):
60-
roll_value = sum([randint(1, sides) for d in range(count + 1)])
58+
roll_value = sum([randint(1, sides) for _ in range(count + 1)])
6159
roll_label.text = str(roll_value)
6260
roll_label.x = 120 - (roll_label.bounding_box[2] // 2)
6361
duration = (i * 0.05) / 2
@@ -66,8 +64,8 @@ def roll(count, sides):
6664

6765

6866
def update_display(count, sides):
69-
selection_label.text = '{0}d{1}'.format(count + 1, SIDES[sides])
70-
selection_label.x = 120 - (selection_label.bounding_box[2] // 2)
67+
select_label.text = '{0}d{1}'.format(count + 1, SIDES[sides])
68+
select_label.x = 120 - (select_label.bounding_box[2] // 2)
7169
roll_label.text = ''
7270

7371

OozeMaster3000/OozeMaster3000.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// OOZE MASTER 3000: NeoPixel simulated liquid physics. Up to 7 NeoPixel
22
// strands dribble light, while an 8th strand "catches the drips."
3-
// Designed for the Adafruit Feather M0 (NOT M4) with NeoPXL8 FeatherWing.
4-
// This can be adapted for other M0 or M4 boards but you will need to do your
5-
// own "pin sudoku" and level shifting (e.g. NeoPXL8 Friend breakout or similar).
3+
// Designed for the Adafruit Feather M0 or M4 with matching version of
4+
// NeoPXL8 FeatherWing. This can be adapted for other M0 or M4 boards but
5+
// you will need to do your own "pin sudoku" and level shifting
6+
// (e.g. NeoPXL8 Friend breakout or similar).
67
// See here: https://learn.adafruit.com/adafruit-neopxl8-featherwing-and-library
78
// Requires Adafruit_NeoPixel, Adafruit_NeoPXL8 and Adafruit_ZeroDMA libraries.
89

@@ -18,9 +19,13 @@ uint8_t dripColor[] = { 0, 255, 0 }; // Bright green ectoplasm
1819
// for a more theatric effect / to slow down the drips like they've still got a
1920
// syrupy "drool string" attached (try much lower values like 2.0 to 3.0).
2021

21-
// NeoPXL8 pin numbers (these are default connections on NeoPXL8 FeatherWing)
22+
// NeoPXL8 pin numbers (these are default connections on NeoPXL8 M0 FeatherWing)
2223
int8_t pins[8] = { PIN_SERIAL1_RX, PIN_SERIAL1_TX, MISO, 13, 5, SDA, A4, A3 };
2324

25+
// If using an M4 Feather & NeoPXL8 FeatherWing, use these values instead:
26+
//int8_t pins[8] = { 13, 12, 11, 10, SCK, 5, 9, 6 };
27+
28+
2429
typedef enum {
2530
MODE_IDLE,
2631
MODE_OOZING,

0 commit comments

Comments
 (0)