MatrixPortal Weather plus Clock
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MatrixPortal Weather plus Clock

by chrisw63 on Wed May 04, 2022 9:49 pm

My wife and I like to keep up with the weather, so when ADABOX 016 came along, I found John Park's Weather Display Matrix a perfect fit. Playing around in the code, I noticed it gets the time from adafruit.io, but never actually uses it. I wondered if four digits of time could fit in the same space as the Temperature, and after some digging to get the time variables from the time struct, it did!

I spent most of a day playing around with it due to a wrong assumption, but eventually got it working pretty well. The time swaps with the temperature every 10 seconds. I just constructed an fstring with the time and replaced the temperature text in gfx.temp_text.text, then moved it over with gfx.temp_text.x. Ten seconds later, it replaces the x coord with the original value and grabs the temperature from the 'value' variable that holds the huge data blob returned from OpenWeather.org. Note that, although I decreased the time between calls to network.get_local_time() to ten minutes (probably didn't need to...), the added code doesn't call it or the weather retrieval code, so the display doesn't stall any more than it did before.

If you want to run the code on your MatrixPortal, head over to https://github.com/chrisw63/MatrixPortalWeatherPlusTime.. It's not compiled, so you can see all the code before downloading.

Posts: 31
Joined: Thu Nov 07, 2013 5:39 pm

Re: MatrixPortal Weather plus Clock

by adafruit_support_mike on Sat May 07, 2022 4:35 pm

Nice.. thanks for posting the link!

Posts: 64805
Joined: Thu Feb 11, 2010 2:51 pm

Re: MatrixPortal Weather plus Clock

by johnpark on Fri May 13, 2022 2:57 pm

very cool, thanks for sharing this!

Posts: 941
Joined: Wed Mar 25, 2009 2:15 pm

Please be positive and constructive with your questions and comments.