Skip to content

Commit 0b7ce3e

Browse files
authored
Merge branch 'master' into master
2 parents 7c2f8e2 + 24ad4e8 commit 0b7ce3e

File tree

11 files changed

+78
-12
lines changed

11 files changed

+78
-12
lines changed

CLUE_Egg_Drop/clue_egg_drop.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import board
44
from digitalio import DigitalInOut, Direction, Pull
55
import pulseio
6-
from adafruit_lsm6ds import LSM6DS33, AccelRange, AccelHPF, Rate
6+
from adafruit_lsm6ds.lsm6ds33 import LSM6DS33
7+
from adafruit_lsm6ds import AccelRange, AccelHPF, Rate
78
from adafruit_display_text import label
89
import displayio
910
import terminalio

Matrix_Portal_Moon_Clock/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def __init__(self, datetime, hours_ahead, utc_offset):
175175
DISPLAY = MATRIX.display
176176
ACCEL = adafruit_lis3dh.LIS3DH_I2C(busio.I2C(board.SCL, board.SDA),
177177
address=0x19)
178+
_ = ACCEL.acceleration # Dummy reading to blow out any startup residue
179+
time.sleep(0.1)
178180
DISPLAY.rotation = (int(((math.atan2(-ACCEL.acceleration.y,
179181
-ACCEL.acceleration.x) + math.pi) /
180182
(math.pi * 2) + 0.875) * 4) % 4) * 90
@@ -368,7 +370,7 @@ def __init__(self, datetime, hours_ahead, utc_offset):
368370
GROUP[0] = TILE_GRID
369371

370372
# Update percent value (5 labels: GROUP[1-4] for outline, [5] for text)
371-
if PERCENT >= 100:
373+
if PERCENT >= 99.95:
372374
STRING = '100%'
373375
else:
374376
STRING = '{:.1f}'.format(PERCENT + 0.05) + '%'
@@ -421,4 +423,5 @@ def __init__(self, datetime, hours_ahead, utc_offset):
421423
GROUP[7].x = CENTER_X - GROUP[7].bounding_box[2] // 2
422424
GROUP[7].y = TIME_Y + 10
423425

426+
DISPLAY.refresh() # Force full repaint (splash screen sometimes sticks)
424427
time.sleep(5)

Pixel_Art_Slideshow/bmps/adabot.bmp

3.05 KB
Binary file not shown.

Pixel_Art_Slideshow/bmps/frong.bmp

6.05 KB
Binary file not shown.

Pixel_Art_Slideshow/bmps/pipe.bmp

6.05 KB
Binary file not shown.

Pixel_Art_Slideshow/bmps/ruby.bmp

3.05 KB
Binary file not shown.
6.05 KB
Binary file not shown.

Pixel_Art_Slideshow/bmps/sword.bmp

2.05 KB
Binary file not shown.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"""
2+
Slideshow Example using the Matrix Portal and 64 x 32 LED matrix display
3+
Written by Melissa LeBlanc-Williams for Adafruit Industries
4+
Images smaller than 64 pixel width will be aligned alternating left or right
5+
Press Up button to pause/resume Slideshow
6+
Press Down button to advance
7+
"""
8+
import time
9+
import board
10+
from digitalio import DigitalInOut, Pull
11+
from adafruit_matrixportal.matrix import Matrix
12+
from adafruit_slideshow import SlideShow, PlayBackDirection, HorizontalAlignment
13+
from adafruit_debouncer import Debouncer
14+
15+
IMAGE_DURATION = 3
16+
IMAGE_FOLDER = "/bmps"
17+
18+
# --- Display setup ---
19+
matrix = Matrix(bit_depth=6)
20+
display = matrix.display
21+
22+
pin_down = DigitalInOut(board.BUTTON_DOWN)
23+
pin_down.switch_to_input(pull=Pull.UP)
24+
button_down = Debouncer(pin_down)
25+
pin_up = DigitalInOut(board.BUTTON_UP)
26+
pin_up.switch_to_input(pull=Pull.UP)
27+
button_up = Debouncer(pin_up)
28+
29+
align_right = True
30+
auto_advance = True
31+
32+
slideshow = SlideShow(
33+
display,
34+
None,
35+
folder=IMAGE_FOLDER,
36+
order=0,
37+
auto_advance=False,
38+
fade_effect=False,
39+
dwell=IMAGE_DURATION,
40+
h_align=HorizontalAlignment.RIGHT,
41+
)
42+
last_advance = time.monotonic()
43+
44+
45+
def advance():
46+
# pylint: disable=global-statement
47+
global align_right, last_advance
48+
align_right = not align_right
49+
if align_right:
50+
slideshow.h_align = HorizontalAlignment.RIGHT
51+
else:
52+
slideshow.h_align = HorizontalAlignment.LEFT
53+
last_advance = time.monotonic()
54+
slideshow.advance()
55+
56+
57+
while True:
58+
if auto_advance and time.monotonic() > last_advance + IMAGE_DURATION:
59+
advance()
60+
button_down.update()
61+
button_up.update()
62+
if button_up.fell:
63+
auto_advance = not auto_advance
64+
if button_down.fell:
65+
slideshow.direction = PlayBackDirection.FORWARD
66+
advance()

PyGamer_Thermal_Camera/code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
from adafruit_bitmap_font import bitmap_font
1111
from adafruit_display_shapes.rect import Rect
1212
import adafruit_amg88xx
13-
from adafruit_pybadger import PyBadger
13+
from adafruit_pybadger import pybadger as panel
1414
from thermal_cam_converters import celsius_to_fahrenheit, fahrenheit_to_celsius
1515
# Load default alarm and min/max range values list from config file
1616
from thermal_cam_config import ALARM_F, MIN_RANGE_F, MAX_RANGE_F
1717

1818
# Establish panel instance and check for joystick
19-
panel = PyBadger(pixels_brightness=0.1) # Set NeoPixel brightness
20-
panel.pixels.fill(0) # Clear all NeoPixels
19+
panel.pixels.brightness = 0.1 # Set NeoPixel brightness
20+
panel.pixels.fill(0) # Clear all NeoPixels
2121
if hasattr(board, "JOYSTICK_X"):
2222
panel.has_joystick = True # PyGamer
2323
else: panel.has_joystick = False # Must be PyBadge

VOTE_Keyboard/code.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import board
22
from digitalio import DigitalInOut, Direction, Pull
3-
import adafruit_dotstar as dotstar
3+
import usb_hid
44
from adafruit_hid.keyboard import Keyboard
55
from adafruit_hid.keycode import Keycode
66
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
77

8-
dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
9-
dot[0] = (0, 0, 0)
10-
11-
kbd = Keyboard()
8+
kbd = Keyboard(usb_hid.devices)
129
kbdLayout = KeyboardLayoutUS(kbd)
1310
state = []
1411
pins = {}
@@ -58,8 +55,7 @@
5855
for oldID in oldState:
5956
if not oldID in newState:
6057
kbd.release(buttonIDtoKeycode[oldID])
61-
dot[0] = (0, 0, 0)
6258
if newBtn:
6359
kbd.press(buttonIDtoKeycode[newBtn])
64-
dot[0] = (255, 0, 0)
6560
state = newState
61+

0 commit comments

Comments
 (0)