LED matrix 32x8 WS2812B font problems

Hi All,
I have this screen and I cannot use the fonts with it.

The following code works, displaying 'Hello' ( the font is too big however)
but when I uncomment line 43 (display.setFont(&FreeMono18pt7b):wink:
The display produces a series of dashes ion the top line instead of letters

I have experimented with several fonts but they all come out illegible - except the default font!

Any ideas?
Thanks!

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <FastLED.h>


//#include  <Fonts/Tiny3x3a2pt7b.h>
//#include  <Fonts/FreeSerif9pt7b.h>
#include  <Fonts/FreeMono18pt7b.h>

#define LED_PIN     6 //Data In pin
#define NUM_LEDS    64
#define BRIGHTNESS  64

CRGB leds[NUM_LEDS];

// Define the LED matrix dimensions and specify the display object
#define MATRIX_WIDTH    32
#define MATRIX_HEIGHT   8
Adafruit_NeoMatrix display = Adafruit_NeoMatrix(MATRIX_WIDTH, MATRIX_HEIGHT, LED_PIN,
                                                NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
                                                NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
                                                NEO_GRB + NEO_KHZ800);

void setup() {
  FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
  FastLED.setBrightness(BRIGHTNESS);

  display.begin(); // Initialize the display object

  display.setRotation(0); // Set the rotation (0, 1, 2, or 3)



}

void loop() {
  display.fillScreen(0); // Clear the display


  
  
  display.setTextColor(display.Color(255, 255, 255)); // Set text color (white)
  //display.setFont(&FreeMono18pt7b);
  display.setTextSize(1); // Set text size

  // Print the text on the LED matrix
  display.setCursor(0, 0);
  display.print("Hello, World!");

  display.show(); // Update the display

  delay(1000); // Delay for 1 second before clearing the display
}

I am guessing here... It seems odd to use FastLED commands after setting the matrix up with Adafruit. Other 32x8 matrix projects use this incluude...

#include <Adafruit_NeoPixel.h>

Do you have the code for one of these projects, so I can test it?
Thanks

Search for "arduino led matrix 32x8 scrolling text"

Thanks, but if I could get the answer by searching I wouldn’t have tried the forum.

Try again. I used those exact terms... and you will see why I posted the information in Post #2.

Your code is mixing FastLED and Adafruit. You can't just copy/paste without giving the result a sanity check. You are trying to fit an 18 point font onto an 8 point matrix. The "Hello" you saw was only the first part of "Hello, World!" The dashes you saw were the bottom parts of characters that are each 3x bigger than your display, probably just the bottom pixels of "Wo"

Start small. Notice differences. See how your sketch is a mess of functions from these two libraries...

One moving pixel using FastLED:

#include <FastLED.h>

#define NUM_LEDS 32*8
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
byte delayval = 50;

void setup() {
  FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(255);
}

void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB::Blue;
    FastLED.show();
    delay(delayval);
    FastLED.clear();
  }
}

One moving pixel using Adafruit_neopixel:

#include <Adafruit_NeoPixel.h>

#define DATAPIN 6
#define NUMPIXELS 8*32

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, DATAPIN, NEO_GRB + NEO_KHZ800);

byte delayval = 50; // delay for half a second
byte colorval = 255; // pixel brightness

void setup() {
  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() {
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,0,colorval));
    pixels.show(); // update the pixel buffer
    delay(delayval);
    pixels.clear();
  }
}

Then read the internet, pick a library, and make a scrolling text.

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>

#define LED_PIN 6 // Data pin
#define DISPLAY_WIDTH 32
#define DISPLAY_HEIGHT 8
#define BRIGHTNESS 255 // 64
byte delayval = 30;

Adafruit_NeoMatrix display = Adafruit_NeoMatrix(DISPLAY_WIDTH, DISPLAY_HEIGHT, LED_PIN,
                             NEO_MATRIX_TOP + // NEO_MATRIX_BOTTOM
                             NEO_MATRIX_LEFT + // NEO_MATRIX_RIGHT
                             NEO_MATRIX_ROWS + // NEO_MATRIX_COLUMNS
                             NEO_MATRIX_PROGRESSIVE, // NEO_MATRIX_ZIGZAG,
                             NEO_GRB + // NEO_RGB
                             NEO_KHZ800 // NEO_KHZ400
                                               );

void setup() {
  display.begin(); // Initialize the display object
  display.setTextWrap(false);
  display.setBrightness(255);
  display.setTextColor(display.Color(255, 255, 255)); // Set text color (white)
}

int scroll = display.width();
char sometext[] = {"Follow instructions next time.\0"};
int scrollwidth = sizeof(sometext) * 6; // each character is 5 pixels plus one kern

void loop() {
  display.fillScreen(0);    //Turn off all the LEDs
  display.setCursor(scroll, 0);
  display.print(sometext);

  if ( --scroll < -scrollwidth ) { // width of sizeof(text)
    scroll = display.width(); // re-start at the right
  }

  display.show();
  delay(delayval);
}

Thank you for helping me eliminate one of the libraries.

I don't think you understood my post though.

I already have scrolling text and some demo graphics working.

I am trying to utilise some of the alternative fonts --anything other than the default font.

I have tried using your code to include another font ( following the Adafruit instructions)

The code I originally provided (which already works) indicates a zigzag wiring in columns... so I have changed your code to:

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>

#include <Fonts/FreeMonoBoldOblique12pt7b.h>

#define LED_PIN 6 // Data pin
#define DISPLAY_WIDTH 32
#define DISPLAY_HEIGHT 8
#define BRIGHTNESS 255 // 64
byte delayval = 30;

Adafruit_NeoMatrix display = Adafruit_NeoMatrix(DISPLAY_WIDTH, DISPLAY_HEIGHT, LED_PIN,
                             NEO_MATRIX_TOP + // NEO_MATRIX_BOTTOM
                             NEO_MATRIX_LEFT + // NEO_MATRIX_RIGHT
                             NEO_MATRIX_COLUMNS +//NEO_MATRIX_ROWS 
                             NEO_MATRIX_ZIGZAG, // NEO_MATRIX_ZIGZAG, NEO_MATRIX_PROGRESSIVE
                             NEO_GRB + // NEO_RGB
                             NEO_KHZ800 // NEO_KHZ400
                                               );

void setup() {
  display.begin(); // Initialize the display object
  display.setTextWrap(false);
  display.setBrightness(255);
  display.setTextColor(display.Color(255, 255, 255)); // Set text color (white)
  display.setFont(&FreeMonoBoldOblique12pt7b);
}

int scroll = display.width();
char sometext[] = {"Hello"};
int scrollwidth = sizeof(sometext) * 6; // each character is 5 pixels plus one kern

void loop() {
  display.fillScreen(0);    //Turn off all the LEDs
  display.setCursor(scroll, 0);
  display.print(sometext);

  if ( --scroll < -scrollwidth ) { // width of sizeof(text)
    scroll = display.width(); // re-start at the right
  }

  display.show();
  delay(delayval);
}

However, though your code works with the default font, it fails using any other font.
I was trying to find out whether there was a way of making it work.

Also, people can do without the disparaging and condescending tone. These devices come with no instructions nor supporting websites, and your search terms did not yield any new information.
Cheers

You insinuate I was born knowing how to use these. My search terms worked perfectly. Quoting my own words:

Try again. I used those exact terms

which quote my own words...

It seems odd to use FastLED commands after setting the matrix up with Adafruit.

In your world, giving advice, showing examples, and being right is condescending and disparaging?

Wear a helmet.

Actually, how about you learn to be nice.

I am nice by default. I never start anything. You should concentrate on something else.

I found something for you to read...

I don't spell you like that. And no, giving advice isn't being condescending. The condescending and disparaging parts are where you tell people their code is copied and pasted without thought, make assumptions that people haven't put any work in, or told people that their code is a mess. Or you make assumptions about what people are seeing. Don't you think I would have recognised if the bottom of two letters had been displayed? Or you change the "Hello World!" text to say "Follow instructions next time. \0" All of that stuff is called being a prick, never mind that you haven't used a different font..

Informative. You interpret instruction, suggestions, examples, working code, and criticism as... something your mother taught you.

You felt the need to be snotty. Which is when I needed to be just like you

It is. You ignored my first suggestion it was "odd."

Then you begged for free stuff. I suggested (again) you do some work for yourself... and you got even more snotty...

I could see it.... and you did not. Do you need that spelled out, too?

Follow instructions next time. Or, continue to ignore instructions and see where it gets you. I followed my own instructions and was able to produce a solution.

And I never will... for you... ever. For absolutely anyone else I will (have) forego sleep for days to help solve their problem. Aren't I the worst?

Things like this: Stepper motor project - #5 by xfpd
And this: My buzzer don't want to stop midway - #6 by xfpd
Or this: Necesito ayuda en un codigo - #3 by xfpd
Maybe this: Attiny10: Toggle LED only after set amount of time - #2 by xfpd
This? Control velocidad de servo 5.5kg giro 360 entre 15 y 30 rpm - #4 by xfpd
Maybe this one? Helpneeded for a project - #5 by xfpd
I have more to give here (and will): LAFVIN 2WD Smart Robot Car Kit V2.2 (updating)
And this: Beginner stopwatch - #5 by xfpd
and... that was last week.

Here is what you want:
Well, bless your little heart. At least you tried. That's what counts. Here's free stuff.

Here is what you get:
You need to concentrate on your project and advice toward solutions, follow instructions, accept criticism, and show some effort. If you feel the need to start something, that's your problem.

Dude, there are many things you have written here that did not happen. Thanks for your suggestions, and yeah it's great you've helped others. Keep up the good stuff. Sorry for my initial, slightly flippant comment, I did use your search terms and found I had already read that material, but it was a bit snotty of me, you are right on that. I will try to improve. We all should.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.