ST7735 TFT Display with NeoMatrix

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
shaymar
 
Posts: 3
Joined: Fri Oct 28, 2022 1:18 am

ST7735 TFT Display with NeoMatrix

Post by shaymar »

Hi there, I'm having an issue running ST7735 1.8 TFT display with a flexible 32x8 NeoPixel RGB LED Matrix.
I've connected both and when I execute a demo for each one of them, it's working. However, if I combine the code, the moment I initialize the TFT display with "tft.initR(INITR_BLACKTAB);", the NeoMatrix will not work (no Leds will be shown) and only the TFT display will work.

For the demos POCs I used the displayOnOffTest for the TFT and the tiletest for the NeoMatrix

Here's the combined code:

Code: Select all

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#include <SPI.h>

#define TFT_CS        10
#define TFT_RST        8 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC         9

#define MATRIX_PIN 12

/* -------- TFT ----------- */

// For 1.44" and 1.8" TFT with ST7735 (including HalloWing) use:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

// color definitions
const uint16_t  Display_Color_Black        = 0x0000;
const uint16_t  Display_Color_Blue         = 0x001F;

// The colors we actually want to use
uint16_t        Display_Text_Color         = Display_Color_Black;
uint16_t        Display_Backround_Color    = Display_Color_Blue;

/* -------- NEO MATRIX ----------- */

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, MATRIX_PIN,
  NEO_MATRIX_BOTTOM    + NEO_MATRIX_RIGHT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
  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]);

  // Use this initializer if using a 1.8" TFT screen:
  tft.initR(INITR_BLACKTAB);      // Init ST7735S chip, black tab - This will break NeoMatrix
  // initialise the display
  tft.setFont();
  tft.fillScreen(Display_Backround_Color);
  tft.setTextColor(Display_Text_Color);
  tft.setTextSize(1);
  tft.println("Hello World!");
}

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);
}
Many Thanks!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: ST7735 TFT Display with NeoMatrix

Post by mikeysklar »

What controller are you driving this with?

What are you using for power?

Since the two example code demos run correctly independently it sounds like a possible pin conflict or power issue (eg. not enough for both).

User avatar
shaymar
 
Posts: 3
Joined: Fri Oct 28, 2022 1:18 am

Re: ST7735 TFT Display with NeoMatrix

Post by shaymar »

I'm using Arduino Uno to control them.
I tried also connecting them to an external 5v 3A power supply but the same issue.

Can you elaborate more on pin conflict? I'm using different pins for the NeoMatrix and the TFT

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: ST7735 TFT Display with NeoMatrix

Post by mikeysklar »

The ST7735 TFT is connected via SPI. The Arduino UNO uses pin 12 as MISO (part of SPI) so you have created a conflict by putting the NeoMatrix on pin 12. Use pin# 3, 5 or 6 for the NeoMatrix avoid a conflict.

User avatar
shaymar
 
Posts: 3
Joined: Fri Oct 28, 2022 1:18 am

Re: ST7735 TFT Display with NeoMatrix

Post by shaymar »

Works. Thank you!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: ST7735 TFT Display with NeoMatrix

Post by mikeysklar »

Good job. Thank you for the confirmation that the pin change resolved it.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”