Network Connected RGB Matrix Clock
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Network Connected RGB Matrix Clock
I have just built the "Network Connected RGB Matrix Clock"- By John Park. Using matrix portal m4 ( from adafruit) and adafruit 64x32 RGB LED Matrix - 4mm pitch (from mouser). I am not getting anything on the display. This is my first project with circuit python. Appreciate any help. thanks
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Network Connected RGB Matrix Clock
More context would help. Photos of the setup/wiring/connections. The code you are using. REPL output when it runs. Etc. Simply saying "It didn't work" doesn't give us much to work from.
Dave
Dave
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Re: Network Connected RGB Matrix Clock
Hello Dave
Have attached my files and a picture.
[attachment=0]rbg clock.rar[/attachment
Have attached my files and a picture.
[attachment=0]rbg clock.rar[/attachment
- Attachments
-
- rbg clock.rar
- Files for the clock project
- (7.44 KiB) Downloaded 38 times
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Re: Network Connected RGB Matrix Clock
one more file from the project
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Network Connected RGB Matrix Clock
What is it with RARs today (or really any day since 2000)? Can you just paste the test/image rather than expecting us to click a suspicious looking link?
Dave
Dave
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Network Connected RGB Matrix Clock
You have a code.py and secrtets.py in CIRCUITPY/lib as well as CIRCUITPY/. I don't think that will cause a problem (well, code.py shouldn't) but it's unusual and probably a mistake.
Please paste code as text, not a screenshot.
What do you see in the REPL when you run the code?
Dave
Please paste code as text, not a screenshot.
What do you see in the REPL when you run the code?
Dave
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Re: Network Connected RGB Matrix Clock
Code: Select all
# Metro Matrix Clock
# Runs on Airlift Metro M4 with 64x32 RGB Matrix display & shield
import time import board import displayio import terminalio
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font
from adafruit_matrixportal.network import Network
from adafruit_matrixportal.matrix import Matrix
BLINK = True DEBUG = False
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError :
print("WiFi secrets are kept in secrets.py, please add them there!" )
raise
print(" Metro Minimal Clock" )
print("Time will be set for {}" .format(secrets["timezone"]))
# --- Display setup --- matrix = Matrix() display = matrix.display
network = Network(status_neopixel =board.NEOPIXEL, debug=False) # --- Drawing setup ---
group = displayio.Group() # Create a Group
bitmap = displayio.Bitmap(64, 32, 2) # Create a bitmap object,width, height, bit depth
color = displayio.Palette(4) # Create a color palette color[0] = 0x000000 # black background
color[1] = 0xFF0000 # red color[2] = 0xCC4000 # amber color[3] = 0x85FF00 # greenish
# Create a TileGrid using the Bitmap and Palette
tile_grid = displayio.TileGrid(bitmap, pixel_shader =color) group.append(tile_grid) # Add the TileGrid to the Group display.show(group)
if not DEBUG:
font = bitmap_font .load_font("/IBMPlexMono-Medium-24_jep.bdf" )
else:
font = terminalio.FONT clock_label = Label(font)
def update_time (*, hours=None, minutes=None, show_colon =False): now = time.localtime() # Get the time values we need
if hours is None: hours = now[3]
if hours >= 18 or hours < 6: # evening hours to morning clock_label .color = color[1]
else:
clock_label .color = color[3] # daylight hours
if hours > 12: # Handle times later than 12:59 hours -= 12
elif not hours: # Handle times between 0:00 and 0:59 hours = 12
if minutes is None: minutes = now[4]
if BLINK:
colon = ":" if show_colon or now[5] % 2 else " "
else:
colon = ":"
clock_label .text = "{hours}{colon}{minutes:02d}" .format( hours=hours, minutes=minutes, colon=colon
)
bbx, bby, bbwidth, bbh = clock_label .bounding_box # Center the label
clock_label .x = round(display.width / 2 - bbwidth / 2) clock_label .y = display.height // 2
if DEBUG:
print("Label bounding box: {},{},{},{}" .format(bbx, bby, bbwidth, bbh))
print("Label x: {} y: {}" .format(clock_label .x, clock_label .y))
last_check = None
update_time (show_colon =True) # Display whatever time is on the board group.append(clock_label ) # add the clock label to the group
while True:
if last_check is None or time.monotonic() > last_check + 3600:
try:
update_time (
show_colon =True
) # Make sure a colon is displayed while updating network.get_local_time () # Synchronize Board's clock to Internet last_check = time.monotonic()
except RuntimeError as e:
print("Some error occured, retrying! -" , e)
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Re: Network Connected RGB Matrix Clock
output on repl
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
- ishankum
- Posts: 24
- Joined: Tue Dec 21, 2021 10:46 am
Re: Network Connected RGB Matrix Clock
have removed code.py and secrets.py from the lib folder
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Network Connected RGB Matrix Clock
The indentation of your code got lost somehow.. and there's weird whitespace issues. Can you try again and make sure it looks exactly like what's in CIRCUITPY/code.py.
You can use the
You can use the
Code: Select all
tags to surround it.
Dave
Please be positive and constructive with your questions and comments.