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/MatrixPorta ... rPlusTime.. It's not compiled, so you can see all the code before downloading.
MatrixPortal Weather plus Clock
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: MatrixPortal Weather plus Clock
Nice.. thanks for posting the link!
- johnpark
- Posts: 985
- Joined: Wed Mar 25, 2009 2:15 pm
Re: MatrixPortal Weather plus Clock
very cool, thanks for sharing this!
Please be positive and constructive with your questions and comments.