Skip to main content

Show various effects on a Pimoroni LED shim.

Project description

led-shim-demo

GitHub Over-Engineered PyPi Package Python Versions

Travis Coverage Status GitHub tag (latest SemVer)

Travis Coverage Status

An application to display a variety of effects on the Raspberry Pi led-shim from Pimoroni.

The effects are based on the examples given in the base library plus some additions from my fork.

  • Binary Clock - Shows hours, minutes and seconds.
  • Candle - A flickering candle.
  • CheerLights - Synchronize with the CheerLights "Internet of Things" project.
  • Coloured Lights - Simple coloured lights like Xmas lights.
  • Digital Rain - Cut price Matrix effect.
  • Gradient Graph - A moving colour gradient determined by the height of a sine wave.
  • Rainbow - A slowly moving rainbow effect.
  • Random Blink - Some random blinking.
  • Solid Colours - A basic effect which just shows a sequence of solid colours.

Installing

Install on Raspbian using:

sudo pip3 install ledshimdemo

Or update using:

sudo pip3 install -U ledshimdemo

Running

$ ledshimdemo --help

Usage: ledshimdemo [OPTIONS] [EFFECTS_SELECTED]...

  Show various effects on a Pimoroni LED shim.

  To limit the effects shown use the effect-list option to list the effects
  available then add them to the command line as required. Otherwise all
  effects will be shown.

Options:
  --version                       Show the version and exit.
  -l, --effect-list               List the effects available and exit.
  -d, --effect-display [CYCLE|RANDOM]
                                  How the effects are displayed.  [default:
                                  CYCLE]
  -u, --effect-duration INTEGER RANGE
                                  How long to display each effect for, in
                                  seconds (1-180).  [default: 10]
  -r, --repeat-run INTEGER RANGE  How many times to run the effects before
                                  stopping (1-240).  [default: 1]
  -b, --brightness INTEGER RANGE  How bright the effects will be (1-10).
                                  [default: 8]
  -i, --invert                    Change the display orientation.
  -o, --log-level [DEBUG|VERBOSE|INFO|WARNING]
                                  Show additional logging information.
                                  [default: WARNING]
  --help                          Show this message and exit.

Troubleshooting

If anything is going to cause a problem trying to run ledshimdemo it will be NumPy which is used by a couple of the demos. The NumPy package is included in most builds of Raspbian, but installed with apt-get, this then causes problems if anything tries to install a different version with pip3. For this reason ledshimdemo is set to use the Raspbian default version (see setup.py) to try and avoid installing a different version with pip3. However, if you do get a runtime error indicating a corrupted NumPy you could first try uninstalling any local pip3 versions of it to see if that helps.

pip3 uninstall numpy

Addendum

This project is somewhat over-engineered for what it actually does because it's being used as a learning exercise.

The application has a number of output logging levels built into it, including a custom VERBOSE level, to show some of the inner workings. This is just because.

The effects are loaded dynamically using a mechanism loosely based on code from this Python3 factory pattern example.

The code coverage for this project is a good example of why measuring unit test coverage can be a misleading indicator of quality. Whilst it does have plenty of unit tests those for the effects are mostly simple smoke tests which show that the code will run. They don't actually confirm that the effects are producing the desired output.

The development work for this project was done using PyCharm on an Intel x64 machine, as the project was designed to be run on an ARM based Raspberry Pi only a source distribution is uploaded to PyPi. However, when installing under Raspbian it should install the ARM wheel from PiWheels making the installation much faster. See the PiWheels FAQ for more information.

Badges showing the build status and code coverage for both the master and develop branches are shown at the top. This is a simple solution to the problem of trying to make this file specific to the branch it is in.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ledshimdemo-1.0.1.tar.gz (14.5 kB view details)

Uploaded Source

File details

Details for the file ledshimdemo-1.0.1.tar.gz.

File metadata

  • Download URL: ledshimdemo-1.0.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.5.6

File hashes

Hashes for ledshimdemo-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a5f7b51675b5ded5427b0edefc2a9ed51dd3053a7aca574057aecf5a4f2971fe
MD5 db30cb4d284ebff7f939b8b584b85028
BLAKE2b-256 d50fe21d76d38ffd2fa29a93ef1ab0bdb66d1093e0709e19ba2552a0cd28db0e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page