Code Monkey home page Code Monkey logo

smartmatrix's Introduction

SmartMatrix Library for Teensy 3, Teensy 4, and ESP32

SmartMatrix Library is designed to refresh HUB75 LED matrix panels and APA102-compatible addressable LEDs with high quality graphics, using simple Arduino sketches.

128x64 HUB75 Panel Driven with SmartLED Shield for Teensy 4

SmartMatrix Library 4 has support for Teensy 4.1, Teensy 4.0, Teensy 3.6, Teensy 3.5, Teensy 3.2/3.1, Teensy 3.0, as well as experimental support for ESP32.

The code to refresh HUB75 panels takes advantage of platform-specific peripherals like DMA, I2S, FlexIO, and once started runs in the background using interrupts. It takes a lot of work to port SmartMatrix Library to a new platform. We're working on an open source solution that will allow a lot more platforms to drive HUB75 panels, sign up for updates here if you're interested.

The documentation in this README contains the basic information you may need to run your first SmartMatrix Library sketch, but there is more detailed documentation in the SmartMatrix Wiki.

Hardware

SmartMatrix Library runs best on the Teensy 4.0 and 4.1 using the SmartLED Shield for Teensy 4, available from distributors in the US and China. If you want to use the less powerful but more mature Teensy 3, you can use the SmartLED Shield for Teensy 3, available from Adafruit, SparkFun, Digi-Key, and other distributors around the globe. The shield doesn't require any soldering to get started, besides putting pins on your Teensy board.

SmartLED Shield for Teensy 3 - Photo Courtesy Adafruit

There's an adapter PCB design to upgrade SmartLED Shield for Teensy 3 to work with the Teensy 4.

You can wire up a bare Teensy 3.x to a HUB75 panel, but at a minimum it's recommended to use 5V level shifters to drive the panels with the voltage level they are expecting. There's a recommended circuit with latch chip to use with the Teensy 3 that will reduce the amount of pins used. The Teensy 4 requires an external latch.

The shields are Open Source Hardware, with design files posted in the /extras/hardware/ directories.

Documentation for the SmartLED Shield Hardware is available here: SmartMatrix Docs

Teensy 4

Teensy 4 support was contributed by Eric Eason

Teensy 4 APA102 support depends on FlexIO_t4 by KurtE, which is included as a submodule in src/lib/. The original FlexIO_t4 library is on GitHub

ESP32

The ESP32 platform is supported with SmartMatrix Library 4.0, but not all features are up to par with the Teensy 3/4 ports. For details on the ESP32 port, see the Wiki

Changes from SmartMatrix Library 3.x

  • Sketches written for SmartMatrix Library 3.x should work with SmartMatrix Library 4.0 with a few changes.
  • See MIGRATION.md for details on how to update your SmartMatrix Library 3.x sketches for SmartMatrix Library 4.x
  • A lot of files were subtly renamed, just changing the case. If you're trying to use git to check out a commit and get an error like The following untracked working tree files would be overwritten by checkout, you may need to use git from the command line and add the -f parameter to force checkout (throwaway local modifications), as your git client might think it's overwriting the case-changed files and losing data.

New Features in SmartMatrix Library 4.0

  • Support for Teensy 4 and ESP32
  • Support for driving APA102 LEDs on Teensy platforms
  • New "GFX" layers rewritten for better efficiency, and using Adafruit_GFX for drawing, fonts, including much larger fonts
  • Support for panels with non-standard mapping, e.g. 16x32/4 (MOD4) panels
  • See more features in the SmartMatrix Wiki

HUB75 Panels

HUB75 RGB panels are typically used for LED billboards (e.g. Times Square), making them cost-effective and readily available. They’re much cheaper per-pixel than addressable LEDs, and available in a wide range of pixel pitch (as of now, 2 mm spacing up to 10 mm spacing per LED). They do require an external controller to continually send data to the panels to refresh them line by line, and that’s where the SmartLED Shield and SmartMatrix library come in. Adafruit, Sparkfun, and other distributors carry panels that are known to be compatible with SmartLED Shield and the SmartMatrix library, but most panels on AliExpress and other sources are compatible as well.

The pixel pitch and "RGB" are good search terms on Aliexpress, e.g. "P6 RGB" for a 6 mm pitch RGB HUB75 panel.

HUB75 Panels Ranging from P2 to P10 pitch

Getting Started

To download in Arduino Library form, see Releases on GitHub, or use Arduino Library Manager.

Software and Teensy Setup

This documentation assumes you have a general knowledge of the Teensy 3 or Teensy 4, how to use the Arduino IDE, and the Teensyduino addon. If you need an overview of any of those tools, please use these references:

Make sure you have a supported version of the Arduino IDE and Teensyduino add-on installed.

Before continuing, use the blink example in the Arduino IDE to verify you can compile and run a sketch on your Teensy 3.1/3.2.

Download the latest version of the SmartMatrix Library, or install it from Arduino Library Manager:
SmartMatrix Releases - GitHub

Note: "SmartMatrix" Library used to be listed in Arduino Library Manager under "SmartMatrix3". You may need to look for the library in Arduino Library Manager or your libraries folder under either "SmartMatrix" or "SmartMatrix3" as we transition to the new name.

If you're not using Arduino Library Manager, you need to import the library into Arduino, see instructions from Arduino here:
Arduino - Libraries

Some of the examples depend on other libraries, which you can download separately, or install from Arduino Library Manager. See "External Libraries" below.

Start with the FeatureDemo Example project, included with the library. From the Arduino File menu, choose Examples, SmartMatrix3 (or SmartMatrix), then FeatureDemo.

Find the section at the top with the note // uncomment one line to select your MatrixHardware configuration, and uncomment the file appropriate for your hardware.

You should already have most of the correct Arduino settings to load the FeatureDemo sketch on your Teensy, from running the blink example earlier. For Teensy 3: under Tools, CPU Speed, make sure either 48 MHz or 96MHz (overclock) is selected. (Some libraries are not compatible with the 72MHz CPU). For Teensy 4, use the default CPU speed.

The examples are configured to run on a 32x32-pixel panel. If your resolution is different, adjust the kMatrixWidth and kMatrixHeight variables at the top of the sketch. You may also need to change kPanelType. Some common kPanelType settings:

  • 32-pixel high panels, e.g. 32x32, 64x32: SM_PANELTYPE_HUB75_32ROW_MOD16SCAN
  • 16-pixel high panels, e.g. 32x16: SMARTMATRIX_HUB75_16ROW_MOD8SCAN
  • 64-pixel high panels, e.g. 64x64, 128x64: SM_PANELTYPE_HUB75_64ROW_MOD32SCAN
  • For other less common panels, see more details in MatrixCommonHub75.h and [the wiki][https://github.com/pixelmatix/SmartMatrix/wiki)

You can chain several panels together to create a wider or taller display than one panel would allow. Set kMatrixWidth and kMatrixHeight to the overall width and height of your display. If your display is more than one panel high, set kMatrixOptions to how you tiled your panels:

  • Panel Order - By default, the first panel of each row starts on the same side, so you need a long ribbon cable to go from the last panel of the previous row to the first panel of the next row. SM_HUB75_OPTIONS_C_SHAPE_STACKING inverts the panel on each row to minimize the length of the cable going from the last panel of each row the first panel of the other row.
    • Note SM_HUB75_OPTIONS_C_SHAPE_STACKING isn't compatible with panels that require the Multi Row Refresh Mapping feature (if your kPanelType value includes the column size, it likely requires Multi Row Refresh Mapping, e.g. SM_PANELTYPE_HUB75_16ROW_32COL_MOD2SCAN)
  • Panel Direction - By default the first panel is on the top row. To stack panels the other way, use SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING.
  • To set multiple options, use the bitwise-OR operator e.g. for C-shape Bottom-to-top stacking: const uint8_t kMatrixOptions = (SM_HUB75_OPTIONS_C_SHAPE_STACKING | SM_HUB75_OPTIONS_BOTTOM_TO_TOP_STACKING);

Note: the stacking direction was reversed in the teensylc and teensy4 branches prior to the release of SmartMatrix Library 4.0. The stacking direction is still reversed for the ESP32 Platform as of SmartMatrix Library 4.0.3, and will be fixed at some point in the future.

Click the Upload button, and the sketch should compile and upload to your Teensy, and start running right away.

You can use the FeatureDemo sketch (or other example sketches) as a way to get started with your own project. Inside loop(), find a demo section that is similar to what you want to do with your project, delete the other sections, and save it as as new sketch.

External Libraries

Some SmartMatrix examples require external libraries to compile. You may already have older versions of these libraries installed in Arduino that may be too old to work with SmartMatrix and the examples. It's usually best to use Arduino Library Manager and get the latest version of the library.

Installing Arduino libraries from GitHub has a couple pitfalls. This Adafruit tutorial explains the basics of installing libraries and how to avoid the pitfalls.

GifDecoder and AnimatedGIF

There are two libraries needed for the AnimatedGifs example. Both can be installed from Arduino Library Manager, or you can manually install from GitHub.

GifDecoder

AnimatedGIF

Adafruit_GFX

You can optionally use Adafruit_GFX with SmartMatrix Library. The new "GFX" layers in SmartMatrix Library are much more efficient, and allow for using large fonts for both static display or scrolling across the screen.

Install Adafruit_GFX using Arduino Library Manager or manually from GitHub

FastLED

If you're having trouble compiling sketches that use FastLED and are getting errors that refer to FastLED.h, try compiling the FastLED_Functions example first, which will help narrow down the issue. Also make sure you are using FastLED 3.1 or later.

This error means the FastLED library isn't installed (correctly):
fatal error: FastLED.h: No such file or directory

The FastLED version included with Teensyduino may lag behind the latest. It's better to install FastLED manually using the latest version available from GitHub, or using Arduino Library Manager. If you see any of these errors, you likely have an older version of FastLED installed:
no known conversion for argument 4 from 'CRGB' to 'const rgb24&'
error: 'inoise8' was not declared in this scope

This can be tricky to track down as Teensyduino installs libraries into your Arduino application directory, which might not be in your Arduino sketchbook. Look at the ResolveLibrary messages you get when compiling to make sure that the version of library you want is being used.

You can manually install the latest version of FastLED (3.x or higher) from the FastLED releases page: https://github.com/FastLED/FastLED/releases

Teensy Audio Library

The SpectrumAnalyzer sketches require the Teensy Audio Library, which is included in Teensyduino. If you have trouble compiling, first make sure you can compile the FastLED_Functions example, as FastLED 3.x is also a requirement for this sketch. If you're missing the Audio library, the best way to install is by running the Teensyduino installer. Make sure the "Audio" library is checked during the install.

Troubleshooting

If you need help, the best place to ask for help, or look for others who may have worked through the same issue, is the SmartMatrix Community. Please don't post troubleshooting requests here on GitHub.

If you've found a bug with the code, or want to suggest an improvement, feel free to submit a GitHub Issue or Pull Request.

Supporting SmartMatrix Library Development

A lot of work went into writing SmartMatrix Library, designing the shields, and releasing them as Open Source Hardware. There are real costs in maintaining the documentation and community forum. If they are useful to you and you'd like to say thank you, you can make a donation via PayPal. Thank you!

smartmatrix's People

Contributors

easone avatar ecdr avatar echamberlain avatar embedded-creations avatar focalintent avatar gregfriedland avatar jasoncoon avatar liebman avatar marcmerlin avatar per1234 avatar welshcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartmatrix's Issues

Font Improvements

The fonts in SmartMatrix could use some improvements. I'm collecting a list of updates to make, please let me know if you have anything to add.

  • Only compile in fonts that are used by the Sketch. Also allow user to add their own font without modifying the library.
    • Have sketch refer to font by a pointer to the font object instead of an enum.
  • Consider switching from using bitmaps to more space efficient BDF, like PJRC's graphics library does
  • Support >8-pixel wide fonts
  • change bdf2c lookup table to use unsigned char instead of unsigned short
  • See Issue #47

Major Refactoring - SmartMatrix 3.x

https://github.com/pixelmatix/SmartMatrix/tree/sm3.0

I'm working on a major revision to the SmartMatrix Library that simplifies the SmartMatrix Class into just refreshing the display, and moves the foreground and background layers into separate Layer classes. Instead of using a unique header file to describe the hardware, the configuration is set in the user's sketch, so you can have one version of the library and use it with different sizes of displays. You can create your own Layer outside of the library - for example I made a Fadecandy Layer class that I used to convert the buffers from a port of Fadecandy to SmartMatrix - and you can make your own stackup of layers, with multiple Foreground layers for example.

This requires a lot more code to set up the classes in the sketch, which I was trying to minimize with the initial release of the library, but I think this more flexible approach supports more use cases. The code is hidden away by using a couple #defines that support the most common use cases, and we can add more. I chose to declare buffers in the sketch instead of using malloc in the classes as I wanted the large buffers to show up in memory usage at the end of compilation, and there's no malloc support for creating DMAMEM buffers.

After separating into classes, refactoring to be more generic (no dependencies on MATRIX_WIDTH/HEIGHT defines) and testing on both 16x32 and 32x32 panels, I found the classes worked with 32x64 with barely any changes. I didn't get a chance to use any code from the >32x32 size pull requests from @ncortot, @GaryBoone, and @mrwastl, though maybe I will when adding support for C-shape chaining.

I have the library in a decent state, and FeatureDemo has been tested on 16x32, 32x32, and 32x64 panels. There's an occasional flicker in the 32x64 I haven't tracked down yet. Only the FeatureDemo example is updated to use the new library, though it should be easy to update the rest. (Except for FastLED_Controller, which will need an update to the FastLED Library with SmartMatrix 3.x support)

It's probably a month or more away from an official release as I'm going to be traveling without a laptop for a couple weeks, and want to add support for more display configurations (especially C-shape paneling), to do more testing, and make some efficiency improvements after I get back.

If there are any other features you'd like to see in the next major release, let's start discussing.

Not yet supported:

  • C-shape paneling for >32-pixel height
  • 24-bit (or fewer) color - this is probably best handled through C++ templates which I haven't used before, and isn't a high priority for me, let me know if it is for you (@mrwastl)
  • FastLED_Controller example

Led panel 192 x 64

Hello:

It's possible config SmartMatrix to work with a Led panel 192 x 64 pixel ?, I do this Led panel with 3 x 64*64 pixel led panels, 1/32 Scan, HUB75E.

Kind Regards

Arranging panels in zigzag pattern

I have 8 16x32 panels arranged in the following pattern (note I've also called matrix.setRotation(rotation90)):

imgur images

However, the third row is mirrored (it's meant to read 'KLIP'). I am currently using SMARTMATRIX_OPTIONS_C_SHAPE_STACKING, but have also tried SMARTMATRIX_OPTIONS_NONE and SMARTMATRIX_OPTIONS_BOTTOM_TO_TOP_STACKING (and combinations of those).

Is there any way I can mirror the third row in software?

SmartMatrix + FastLED (Neopixels) ESP32 crash

When using NeoPixels on ESP32 with https://github.com/samguyer/FastLED
everything works fine.
When using https://github.com/FastLED/FastLED instead, SmartMatrix crashes.

Normally I'd blame FastLED but the crash is in SmartMatrix. I'm not very familiar with ESP32 crashes/panics. Are they usually correct about which library is at fault when both cores are used, or could the problem very well be a bug in FastLED master that is fixed in Sam Guyer's branch?

This is not a must fix for me, I'm fine using Sam's ESP32 branch which probably is better/more up to date, but I'm filing this bug in case it points to a problem in SmartMatrix.

Guru Meditation Error: Core 1 panic’ed (Interrupt wdt timeout on CPU1)
PC: 0x400d0f84: SMLayerBackground ::swapBuffers(bool) at /home/merlin/Arduino/libraries/SmartMatrix_ESP32/src/Layer_Background_Impl.h line 921
EXCVADDR: 0x00000000

Decoding stack results
0x400d0f84: SMLayerBackground ::swapBuffers(bool) at /home/merlin/Arduino/libraries/SmartMatrix_ESP32/src/Layer_Background_Impl.h line 921
0x400d1c3c: loop() at /home/merlin/arduino/libraries/SmartMatrix_ESP32/examples/DemoFastLED/DemoFastLED.ino line 163
0x400e7806: loopTask(void*) at /home/merlin/Arduino/hardware/espressif/esp32/cores/esp32/main.cpp line 17

Code:
https://github.com/marcmerlin/SmartMatrix/blob/teensylc/examples/DemoFastLED/DemoFastLED.ino

defaultBrightness calculated incorrectly in FeatureDemo.ino

The parentheses in the two lines that do brightness calculation in FeatureDemo.ino are in the wrong place:

const int defaultBrightness = 100*(255/100); // full brightness
//const int defaultBrightness = 15*(255/100); // dim: 15% brightness

should be:

const int defaultBrightness = (100255)/10); // full brightness
//const int defaultBrightness = (15
255)/100; // dim: 15% brightness

Or you can just leave out the parentheses.

Reduce panel data clock (<5MHz) for Bad Panels

I have some panels from Meiyad that in one batch worked, but in the new batch the image slowly gets worse from panel to panel. Meiyad reproduce the issue, and found a workaround was to slow the data clock to < 5MHz.

I have been tweaking the values in SmartMatrix_Impl.h and MatrixHardwareKit.h, as well as modifying the F_BUS and F_CPU speeds (by providing it both as a PLATFORMIO_BUILD_FLAG and platformio.ini board_f_cpu rate, the newest platformio overrides F_CPU using a default board_f_cpu value).

I have been able to reduce the CPU speed to reduce the distortion, but cannot get low enough to avoid the issue, as going too low breaks USB. I have been checking against the values in mk20dx128.c to use F_CPU and F_BUS rates that are supported.

Using an oscilloscope, it seems the clock value is based on the F_CPU rate and not the F_BUS rate, but is oddly F_CPU / 18. Not sure where the 18 comes from, but if I could increase that, I could leave the CPU rate alone and just slow the data clock to the panel.

consider renaming teensylc branch?

Given what the branch is today, maybe rename it smartmatrixng ?
It's not very obvious to use a teensylc branch for esp32, especially if the branch doesn't work on teensylc (not sure about that part)

How to create additional indexed layers?

Is there a way to create additional indexed layers in a sketch? Or even multiple background layers? I'm building an EV dashboard and I'm using the colors of variables to also indicate their value. Thanks.

FeatureDemo not working on Teensy 3.6 at 180Mhz

Hi,
I´m using the IDE 1.8.5 and Teensyduino 1.42 on OSX and can´t get the Features Demo to work on a teensy 3.6 at 180Mhz. It compiles fine but seems to end in an infinite loop in backgroundLayer.swapBuffers(); because the buffer state is always pending. Any idea what is going wrong ?

SmartMatrix addition: version information + consistent layer API

@embedded-creations:

i'd have two suggestion for smartmatrix:

  • would it be possible to add a version information? (#define's)
    eg:
    #define SMARTMATRIX_VERSION_MAJOR 3
    #define SMARTMATRIX_VERSION_MINOR 1

    plus optionally:
    #define SMARTMATRIX_VERSION_BRANCH colourspaces

  • (public) access to layer buffer or pixel information for all three layer-types

    • background layer has:
      • RGB* backBuffer()
      • const RGB readPixel(x, y)
      • RGB* getRealBackBuffer()
    • scolling layer has:
      • `uint8_t* scollingBitmap;
    • indexed layer has:
      • nothing :(

    at least access to the bitmap information for all three types would be fine, readPixel() would be even better. especially indexed layer is missing this functionality.

background:

i'm currently developing a framework on top of smartmatrix3 that uses panes for displaying information - and these make heavy use of sm3's layer drawing functions.

the defines would be handy for en/disabling features in the framework according to the smartmatrix-version/branch used.

the API of my new toy is currently stabilising and i hope that i'm able to release a somewhat usable version at github soon.

DMAChannel.h missing?

I looked for a DMAChannel library and could not find one. Does it come from outside of the SmartMatrix library folder?

In file included from C:\Users\Englert\Documents\Arduino\libraries\SmartMatrix3\src/SmartMatrix3.h:167:0,

             from C:\Users\Englert\AppData\Local\Temp\arduino_modified_sketch_327038\SmartMatrix.ino:1:

C:\Users\Englert\Documents\Arduino\libraries\SmartMatrix3\src/SmartMatrix_Impl.h:26:24: fatal error: DMAChannel.h: No such file or directory

#include "DMAChannel.h"

                    ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
.

PLay 128x32 animated GIF

Hello.

I need play videos with 128x32 resolution. I have do the animated GIF, but when I config kMatrixWidth with 128 and run, screen show message "No gifs directory".

With same SD card, same files, if I coinfig kMatrixWidth with 32 or 64, then play video but only 32x32, 4 times in screen and only part of the animation screen of the animated GIF.

So, how may I config software to play 128x32 animated GIF videos ?.
My led panels are two P2.5, 64x32 piexel, Scan 1/16 chained.

Thank you and kind regards.

Try improved font code

From Álvaro Monares G.

I had improve the fonts using fonts from any size (width and height), but there is at least a backward compatibility. For instance getBitmapFontRowAtXY I add the X value.
I have try this on a panel 64(width)x32(height) and works, now I don't have the panels so can't continue testing.

It seem to work ok, I also change the location variable at getBitmapFontLocation on MatrixFont.cpp, it was static I remove the static keyword.

SmartMatrix-src.zip

Optimize ISR code

Consider inline for functions only used once in ISR, like circular buffer operations

FeatureDemo won't compile

I am using a brand new SmartMatrix3 shield and the FeatureDemo won't compile in the Arduino IDE. I can run other sketches on the Teensy 3.2 board but none of the SmartMatrix3 library examples are compiling. I've tried different Teensy boards in the IDE as well as clock speeds. Nothing seems to work. I'm building a dashboard for an electric motorcycle build using a 64x32 P3 array from Adafruit.

Error messages attached.
TeensyError.txt

Support HUB75 connectors with wrong order for RGB channels?

Hi!

I just finally got a 64x64 matrix (this one: https://www.aliexpress.com/item/xxx-pictures-indoor-led-video-screen-module-power-supply-controller-led-rgb-matrix-p2-128mmx-128mm/32854261443.html?spm=a2g0s.9042311.0.0.36ad4c4dqlWTlq) and it works just fine with the v4 board!

I noticed one problem though, for some reason my colour channels are shifted (red is blue, green is red, blue is green). I'm assuming this is because of hardware differences between different panels, I'd be happy to look into adding some configuration for that but am unsure where to start looking. Do you have any pointers or ideas where this might be most easily fixed?

Cheers
Rob

FastLED Controller 16x32 support

FastLED includes a SMART_MATRIX controller, which assumes the display is a fixed 32x32 size.

This should really be a FastLED issue, but it's up to us to submit a pull request.

Filled Triangle can crash sketch

Issue from @craiglindley:

I have a corner case for you. I'm playing around with code that draws geometric shapes on the SmartMatrix using parameters that are randomly generated. If I generate a filled triangle with vertices at:

x1: 16
y1: 16
x2: 16
y2: 16
x3: 16
y3: 16

The triangle drawing code hangs and never comes back. I've attached a short sketch that illustrates the problem

#include "SmartMatrix_32x32.h"

// Create instance of matrix
SmartMatrix matrix;

rgb24 red;

/*******************************************************************/
/***                     Main Program Setup                     ***/
/*******************************************************************/

void setup() {

    // Setup serial interface
    Serial.begin(115200);

    // Wait for serial interface to settle
    delay(2000);

    // Initialize 32x32 LED Matrix
    matrix.begin();
    matrix.setBrightness(100);
    matrix.setColorCorrection(cc24);

    // Clear screen
#if (USE_ALPHA_MIXING == 1)
    matrix.fillScreen({0, 0, 0, 255});
    red = {255, 0, 0, 128};
#else
    matrix.fillScreen({0, 0, 0});
    red = {255, 0, 0};

#endif
    matrix.swapBuffers();

}

/*******************************************************************/
/***                      Main Program Loop                      ***/
/*******************************************************************/

void loop() {

    Serial.println("starting up");

    int x1 = 16;
    int y1 = 16;
    int x2 = 16;
    int y2 = 16;
    int x3 = 16;
    int y3 = 16;

    // Draw triangle
    Serial.println("begin drawing triangle");
    matrix.drawTriangle(x1, y1, x2, y2, x3, y3, red);
    Serial.println("end drawing triangle");
    matrix.swapBuffers();

    delay(2000);

    Serial.println("begin drawing filled triangle");
    matrix.fillTriangle(x1, y1, x2, y2, x3, y3, red);

    // Will never get here

    Serial.println("end drawing filled triangle");
    matrix.swapBuffers();

    while (true) {
        ;
    }
}

all sample of Smart Matrix lib Modified by Jason Coon compile error

I don't know why my arduino (1.6.4) win installed FastLED lib along with SmartMatrix_32x32 & LEDMatrix can compile well and issue the following compile error, any help really appreciated

D:\arduino-1.6.4-windows\arduino-1.6.4\libraries\FastLED_3.1.0/FastLED.h: In static member function 'static CLEDController& CFastLED::addLeds(CRGB*, int, int)':
D:\arduino-1.6.4-windows\arduino-1.6.4\libraries\FastLED_3.1.0/FastLED.h:326:32: error: 'CSmartMatrixController' does not name a type
case SMART_MATRIX: { static CSmartMatrixController controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
^
D:\arduino-1.6.4-windows\arduino-1.6.4\libraries\FastLED_3.1.0/FastLED.h:326:83: error: 'controller' was not declared in this scope
case SMART_MATRIX: { static CSmartMatrixController controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }

Colors are wrong. Very yellow.

Sadly, my colors are incorrect with 64x64 on teensy3.6 and SmartLEDShieldV4.h

They are very very yellow-ish. Not at all matching the colors from my GIFs.

Any idea how to fix such issue?

Thanks x100

Smartmatrix shield v4 and Teensey 3.6 not working on 64x32 display

Hey, guys. I bought some 64x32 panels from amazon, got a teensey 3.6 and smartshield v4, hooked everything up( I think, the correct way) and nothing. Plenty of power, code compiles( using the Feature Demo sketch) Loader seems to program, but display does not come on. Without the Teensey/Shield installed, you can touch the pins on the matrix and get a reaction, so I dont think its DOA. Even tried 2 different panels with the same results. Is there something I am missing? Sorry if its a dumb question, but Im a total NOOB to this matrix thing. Any help would be great.

Add background clear for drawString

Conversation from Dangerous Prototypes Blog:
http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=6125&start=105#p58235
http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=6125&sid=005065f89fe07c31d5c89eb38d0ae660&p=58296#p58294

Instead of just
void drawString(int16_t x, int16_t y, rgb24 charColor, const char text[]);

Let's make an overloaded function that includes rgb24 backgroundColor in addition to charColor. The drawing function will fill each pixel for each char with the backgroundColor and then put charColor on top.

Compatibility with Teensy 3.6

Before I embark on a project, I'm wanting to check if this library is compatible with the Teensy 3.5 or 3.6?

Thanks!

Calling matrix.begin() causes Serial1 not work anymore

I've included code to test this out:

Receiving code:

include "SmartMatrix_32x32.h"

SmartMatrix matrix;

void setup()
{
Serial1.begin(115200);
Serial.begin(9600);
}

void loop()
{
if(Serial1.available())
{
char c = Serial1.read();
Serial.print(c);
}

if(Serial.available())
{
char c = Serial.read();
Serial.print(c);
matrix.begin();
}
}

Sender code:

void setup()
{
Serial1.begin(115200);
Serial.begin(9600);
}

int count = 0;

void loop()
{
String x = "Hi there. This is a test message send to the Teensy please.\n";
Serial1.println(count);
count++;
for(int i = 0; i < x.length(); i++)
Serial1.print(x.charAt(i));

  delay(2000);

}

Note that when you enter in character into Serial, it calls matrix.begin() and all messages after that call are never received. I've also contacted Paul S on the Teensy forum (http://forum.pjrc.com/threads/26325-Issues-w-SmartMatrix-Library-Teensy-3-1)

Cannot use ESP32 GPIO0 in I2S bus?

I had already made a board, with my own I2S parallel HUB75 driver, and this board also works with ESP_Sprite's code/driver.

However, it seems I cannot use GPIO0 for any of the I2S signals (my board uses GPIO0<->OE) with SmartMatrix teensylc branch. All other signals seem fine on a logic analyzer (I tested re-assigning to another pin and it looked like the correct signal.) It just won't work on GPIO0 (outputs just a logic high the whole time)

Clock with animated gifs playing behind

Not really an issue but hoping you can help..

Im wanting to make a clock that has the time displayed while playing animated gifs at the same time behind the time maybe one every 30 seconds or so.. Would this be difficult to achieve ? Some pointers on where to start would be very much appreciated if you have the time.

Thanks
Daniel

1/4 scan mode

Would it be possible to implement a 1/4 scan mod for the 16x32 outdoor hub75 matrix ?

Regards,

HCF

Add #defines for including fonts

Idea from Noel Bundy: "Maybe set up some defines to enable/disable fonts? I can see them taking up a fair chunk of space."

MatrixForeground bugs for width > 32

Most of the MatrixForeground methods are hard coded to only operate on the first uint32 of the array i.e. the first screen segment for wider displays. I may take a look at fixing them because it isn't much code, but here's an issue for it just in case it takes me a while.

colorCorrection(const RGB_IN& in, rgb24& out) bug

colorCorrection(const RGB_IN& in, rgb24& out) is using the low bits of the table rather than the high:

fix would be changing the local to rgb48:
template
void colorCorrection(const RGB_IN& in, rgb24& out) {
out = rgb48(lightPowerMap16bit[in.red],
lightPowerMap16bit[in.green],
lightPowerMap16bit[in.blue]);
}

or simply skipping the local:
template
void colorCorrection(const RGB_IN& in, rgb24& out) {
out.red = lightPowerMap16bit[in.red] >> 8;
out.green = lightPowerMap16bit[in.green] >> 8;
out.blue = lightPowerMap16bit[in.blue] >> 8;
}

Sorry to not make a pull request, seemed like too much effort for one line.

ESP32: Refresh fails at higher display sizes: out of memory

Hi,

I found that the library fails at higher panel sizes because
matrixUpdateFrames = (frameStruct *)heap_caps_malloc(sizeof(frameStruct) * ESP32_NUM_FRAME_BUFFERS, MALLOC_CAP_DMA);
returns 0 and therefore the DMA engine does not start sending data.

There are a few other places where assert() is used after malloc without checking the return value.

Optimizing some other tasks (memory-wise) allows me to drive a 64x96 matrix with RGB24. 64x128 still does not work :(

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.