Coder Social home page Coder Social logo

matrixportalweatherplustime's Introduction

MatrixPortalWeatherPlusTime

Modified Adafruit MatrixPortal Weather to add Time. For the original ADABOX 64x32 LED matrix and MatrixPortal M4 board. Follow the install instructions at https://learn.adafruit.com/weather-display-matrix, then replace code.py with this code.

Temperature and 24 hr clock are swapped every 10 seconds.

Most of the additions are in lines 107-120. The time update was reduced from 1 hour to 10 minutes to keep the clock accurate without calling network.get_local_time() every minute (and stalling the display). The only other additions to the code is the 'tunit' variable in the metric/imperial initialization section and dtemptime a couple lines before the main loop. Conversion to 12 hour time would be simple, but there's no room for an AM/PM indicator during double-digit hours, so I left it at 24 hr time.

Coding the first version, I believed the MatrixPortal didn't have a real time clock function. So I coded the minute and ten second counters using time.monotonic(). I knew it wasn't accurate, but I also knew calling network.get_local_time() stalls the display for several seconds - calling it every minute would be ugly and way overkill. The biggest time sink was drilling into openweather_graphics.py and testing live updates of the displayed text variables. While optimizing those and getting them to display correctly (apparently PortalBase does some formatting behind the scenes..), I finally saw it: rtime = rtc.RTC() Are you kidding me?? eesh... One whole section of the code wasn't needed any more, and optimizing the rest took no time at all.

matrixportalweatherplustime's People

Contributors

chrisw63 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.