SkillAgentSearch skills...

Luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.

Install / Use

/learn @rm-hull/Luma.examples
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

luma.core <https://github.com/rm-hull/luma.core>__ | luma.docs <https://github.com/rm-hull/luma.docs>__ | luma.emulator <https://github.com/rm-hull/luma.emulator>__ | luma.examples | luma.lcd <https://github.com/rm-hull/luma.lcd>__ | luma.led_matrix <https://github.com/rm-hull/luma.led_matrix>__ | luma.oled <https://github.com/rm-hull/luma.oled>__

Luma.Examples

.. image:: https://github.com/rm-hull/luma.examples/actions/workflows/main.yml/badge.svg :target: https://github.com/rm-hull/luma.examples/actions/workflows/main.yml

This is the companion repo for running examples against the luma.emulator <https://github.com/rm-hull/luma.emulator>, luma.oled <https://github.com/rm-hull/luma.oled>, luma.lcd <https://github.com/rm-hull/luma.lcd>_ and luma.led_matrix <https://github.com/rm-hull/luma.led_matrix>_ display drivers.

Installation instructions

Assuming you are using a Raspberry Pi (running Raspberry Pi OS), follow the pre-requisites & instructions in the above repositories to wire up your display, then from a command-line::

$ sudo usermod -a -G i2c,spi,gpio pi $ sudo apt install python3-dev python3-pip python3-numpy libfreetype6-dev libjpeg-dev build-essential $ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev

Log out and in again and clone this repository::

$ git clone https://github.com/rm-hull/luma.examples.git $ cd luma.examples

Next, create a virtual environment <https://docs.python.org/3/library/venv.html>__::

$ python3 -m venv ~/luma-env

This creates a virtual environment in the home directory called luma-env and a Python executable at ~/luma-env/bin/python.

Finally, install the luma libraries using in the virtual environment with::

$ ~/luma-env/bin/python -m pip install -e .

Running the examples

After cloning the repository, enter the examples directory and try running one of the following examples listed below. For example::

cd examples ~/luma-env/bin/python 3d_box.py

========================= ================================================================ Example Description ========================= ================================================================ 3d_box.py Rotating 3D box wireframe & color dithering animated_gif.py Renders an animated GIF bitstamp_ticker.py Display the Bitcoin price at Bitstamp bitstamp_realtime.py Displays the latest Bitcoin trades in realtime at Bitstamp bounce.py Display a bouncing ball animation and frames per second carousel.py Showcase viewport and hotspot functionality chroma.py Trippy color rendering demo clock.py An analog clockface with date & time colors.py Color rendering demo crawl.py A vertical scrolling demo, which should be familiar demo.py Use misc draw commands to create a simple image dotmatrixtool.py Simple demo showing how to integrate output from http://dotmatrixtool.com font_awesome.py A meander through some awesome fonts game_of_life.py Conway's game of life greyscale.py Greyscale rendering demo image_composition.py Displays different song titles and scrolls them back and forth invaders.py Space Invaders demo jetset_willy.py Sprite animation framework demo larson_hue.py Alpha blending color demo matrix.py The Matrix maze.py Maze generator perfloop.py Simple benchmarking utility to measure performance picamera_photo.py Capture photo with picamera and display it on a screen picamera_video.py Capture continuous video stream and display it on a screen pi_logo.py Display the Raspberry Pi logo (loads image as .png) runner.py Sprite animation framework demo savepoint.py Example of savepoint/restore functionality scrolling_pixelart.py Image dithering and viewport scrolling sprite_animation.py Using sprite maps for animation effects starfield.py 3D starfield simulation sys_histogram.py Display system information including a rolling histogram sys_info.py Display basic system information sys_info_extended.py Display detailed system information in graph format terminal.py Simple println capabilities tv_snow.py Example image-blitting tweet_scroll.py Using Twitter's Streaming API to display scrolling notifications video.py Display a video clip weather.py 3-day weather forecasts from the BBC welcome.py Unicode font rendering & scrolling ========================= ================================================================

By default, all the examples will asume I2C port 1, address 0x3C and the ssd1306 driver. If you need to use a different setting, these can be specified on the command line – each program can be invoked with a --help flag to show the options::

$ ~/luma-env/bin/python examples/demo.py --help
usage: demo.py [-h] [--config CONFIG] [--display DISPLAY] [--width WIDTH]
                [--height HEIGHT] [--rotate ROTATION] [--interface INTERFACE]
                [--i2c-port I2C_PORT] [--i2c-address I2C_ADDRESS]
                [--spi-port SPI_PORT] [--spi-device SPI_DEVICE]
                [--spi-bus-speed SPI_BUS_SPEED]
                [--spi-transfer-size SPI_TRANSFER_SIZE]
                [--spi-cs-high SPI_CS_HIGH] [--ftdi-device FTDI_DEVICE]
                [--framebuffer-device FRAMEBUFFER_DEVICE] [--gpio GPIO]
                [--gpio-mode GPIO_MODE]
                [--gpio-data-command GPIO_DATA_COMMAND]
                [--gpio-chip-select GPIO_CHIP_SELECT]
                [--gpio-reset GPIO_RESET] [--gpio-backlight GPIO_BACKLIGHT]
                [--gpio-reset-hold-time GPIO_RESET_HOLD_TIME]
                [--gpio-reset-release-time GPIO_RESET_RELEASE_TIME]
                [--block-orientation ORIENTATION] [--mode MODE]
                [--framebuffer FRAMEBUFFER] [--num-segments NUM_SEGMENTS]
                [--bgr] [--inverse] [--h-offset H_OFFSET]
                [--v-offset V_OFFSET] [--backlight-active VALUE] [--debug]
                [--transform TRANSFORM] [--scale SCALE] [--duration DURATION]
                [--loop LOOP] [--max-frames MAX_FRAMES]

luma.examples arguments

options:
  -h, --help            show this help message and exit

General:
  --config CONFIG, -f CONFIG
                        Load configuration settings from a file (default:
                        None)
  --display DISPLAY, -d DISPLAY
                        Display type, supports real devices or emulators.
                        Allowed values are: ssd1306, ssd1309, ssd1322,
                        ssd1362, ssd1322_nhd, ssd1325, ssd1327, ssd1331,
                        ssd1351, sh1106, sh1107, ws0010, winstar_weh, pcd8544,
                        st7735, st7789, ht1621, uc1701x, st7567, ili9341,
                        ili9486, ili9488, hd44780, max7219, ws2812, neopixel,
                        neosegment, apa102, unicornhathd, capture, gifanim,
                        pygame, asciiart, asciiblock, linux_framebuffer
                        (default: ssd1306)
  --width WIDTH         Width of the device in pixels (default: 128)
  --height HEIGHT       Height of the device in pixels (default: 64)
  --rotate ROTATION, -r ROTATION
                        Rotation factor. Allowed values are: 0, 1, 2, 3
                        (default: 0)
  --interface INTERFACE, -i INTERFACE
                        Interface type. Allowed values are: i2c, noop, spi,
                        gpio_cs_spi, bitbang, ftdi_spi, ftdi_i2c, pcf8574,
                        bitbang_6800 (default: i2c)

I2C:
  --i2c-port I2C_PORT   I2C bus number (default: 1)
  --i2c-address I2C_ADDRESS
                        I2C display address (default: 0x3C)

SPI:
  --spi-port SPI_PORT   SPI port number (default: 0)
  --spi-device SPI_DEVICE
                        SPI device (default: 0)
  --spi-bus-speed SPI_BUS_SPEED
                        SPI max bus speed (Hz) (default: 8000000)
  --spi-transfer-size SPI_TRANSFER_SIZE
                        SPI bus max transfer unit (bytes) (default: 4096)
  --spi-cs-high SPI_CS_HIGH
                        SPI chip select is high (gpio_cs_spi driver only)
                        (default: False)

FTDI:
  --ftdi-device FTDI_DEVICE
                        FTDI device (default: ftdi://::/1)

Linux framebuffer:
  --framebuffer-device FRAMEBUFFER_DEVICE
                        Linux framebuffer device (default: /dev/fd0)

GPIO:
  --gpio GPIO           Alternative RPi.GPIO compatible implementation (SPI
                        interface only) (default: None)
  --gpio-mode GPIO_MODE
                        Alternative pin mapping mode (SPI interface only)
                        (default: None)
  --gpio-data-command GPIO_DATA_COMMAND
                        GPIO pin for D/C RESET (SPI interface only) (default:
                        24)
  --gpio-chip-select GPIO_CHIP_SELECT
                        GPIO pin for Chip select (GPIO_CS_SPI interface only)
                        (default: 24)
  --gpio-reset GPIO_RESET
                        GPIO pin for RESET (SPI interface only) (default: 25)
  --gpio-backlight GPIO_BACKLIGHT
                        GPIO pin for backlight (PCD8544, ST7735 devices only)
                       

Related Skills

View on GitHub
GitHub Stars444
CategoryDevelopment
Updated13h ago
Forks163

Languages

Python

Security Score

95/100

Audited on Mar 27, 2026

No findings