Can a Trinket be used with a NeoMatrix? I ordered the 5V Trinket and NeoMatrix shield, and when I tried to upload the sample NeoMatrix code to the Trinket, it said that the code was too big (~6K bytes).
Is it possible to run the NeoMatrix on the Trinket? If so, is there some sample code? Do I need all 3 libraries (NeoPixel, GFX, and NeoMatrix)?
Thanks!
Trinket and NeoMatrix
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Trinket and NeoMatrix
The Adafruit_GFX library is too large for the Trinket (mostly due to the font data).
You can use the regular NeoPixel library, but won't have any of the graphics primitives like lines and rectangles; it essentially works like a NeoPixel strip in a zig-zag arrangement. Basically, only SetPixel(). You could write some wrapper functions to give limited X/Y functionality without invoking the whole NeoMatrix library.
You can use the regular NeoPixel library, but won't have any of the graphics primitives like lines and rectangles; it essentially works like a NeoPixel strip in a zig-zag arrangement. Basically, only SetPixel(). You could write some wrapper functions to give limited X/Y functionality without invoking the whole NeoMatrix library.
- dannya
- Posts: 111
- Joined: Thu Nov 14, 2013 7:35 pm
Re: Trinket and NeoMatrix
Thanks! Can you give me an example of how to modify this code?
Code: Select all
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR
#endif
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(5, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };
void setup() {
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(40);
matrix.setTextColor(colors[0]);
}
int x = matrix.width();
int pass = 0;
void loop() {
matrix.fillScreen(0);
matrix.setCursor(x, 0);
matrix.print(F("Howdy"));
if(--x < -36) {
x = matrix.width();
if(++pass >= 3) pass = 0;
matrix.setTextColor(colors[pass]);
}
matrix.show();
delay(100);
}
- dannya
- Posts: 111
- Joined: Thu Nov 14, 2013 7:35 pm
Re: Trinket and NeoMatrix
Never mind, figured it out. Thanks!
Please be positive and constructive with your questions and comments.