Mamamatrix examples errors (rollback to older smartmatrix library?)

Hello people, Im very new to LED matrices, smartkatrix library, and arduino, but am fairly well versed in Processing language. I read an article on creativeapplications.net which piqued my interest entitled “pysicalising a pixel - LED matrix display tutorial” at https://www.creativeapplications.net/processing/physicalising-a-pixel-led-matrix-display-tutorial-document-1-workshop/ (which is now unfortunately behind a paywall but which presents all the examples on Github at https://github.com/ertdfgcvb/MamaMatrix )

I purchased a shield (v4), a teensy 3.6 and all the relevant bits and pieces and ran the smartmatrix library funtion demo without issue, so moved on the above linked examples, my final intention to stream the output of a processing sketch to my LED matrix via serial > teensy, however am running into errors, namely “out of scope” errors

Ive read the migration entry at the smartmatrix library github page, and am still no closer to solving anything. Im only so far trying to run the a1_singlepixel example from the mamamatrix examples, though aim ultimately to be using the a3_serial_rgb_slave example to recieve serial data from another computer.

My question (after all that, sorry for no0bishness here) is: can anyone either point out how i can overcome the errors, point me to somewhere where i can read up on how to do so myself, or would I simply be better off trying to revert to an older version of the smart matrix lbrary wherby the errors wont occur? Im guessing the errors are due to a change i the syntax of the SM library, but cannot be sure.
If it helps the “physicalising a pixel” tutorial was written on [23/05/2019]

Any and all help is much appreciated. I knew id have some difficulties but every step has proved tough so far! Many thanks in advance.

It’s too bad they moved the article behind a paywall. Here’s an archived version of it I just found: https://web.archive.org/web/20210224232125/https://www.creativeapplications.net/processing/physicalising-a-pixel-led-matrix-display-tutorial-document-1-workshop/

I can compile Example 2 by following MIGRATION.md and replacing:

#include <SmartLEDShieldV4.h>

with

#include <MatrixHardware_Teensy3_ShieldV4.h>
#include <SmartMatrix.h>

I think the instructions weren’t 100% clear on the case where there’s just #include <SmartLEDShieldV4.h> and nothing else, I’ll improve those.

LMK if that works for you. If you keep getting errors, please post the errors.

I don’t think you need to, but if you want to revert to an older version of SmartMatrix Library, go to the SmartMatrix Library Releases page on GitHub, and download the older version you need. Unfortunately you can’t get older versions from Arduino Library Manager. SmartMatrix Library 3 can coexist with SmartMatrix Library 4 so you don’t need to remove the latest version.

Ah sorry, I failed to mention that id already made the changes you suggested (the neccessary changes came up in the errors originally so that was an easy fix)

in the a1 example (the only one ive tried so far) the errors are as follows:

In file included from C:\Users\ollst\Desktop\MamaMatrix-master\a1_single_pixel\a1_single_pixel.ino:13:0:
C:\Users\ollst\Documents\Arduino\libraries\SmartMatrix\src/MatrixHardware_Teensy3_ShieldV4.h:29:17: note: #pragma message: MatrixHardware: SmartLED Shield for Teensy 3 (V4)
#pragma message “MatrixHardware: SmartLED Shield for Teensy 3 (V4)”
^
a1_single_pixel:20: error: ‘SMARTMATRIX_HUB75_32ROW_MOD16SCAN’ was not declared in this scope
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_MOD16SCAN;
^
a1_single_pixel:21: error: ‘SMARTMATRIX_OPTIONS_NONE’ was not declared in this scope
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);
^
a1_single_pixel:22: error: ‘SM_BACKGROUND_OPTIONS_NONE’ was not declared in this scope
const uint8_t kbgOptions = (SM_BACKGROUND_OPTIONS_NONE);
^
a1_single_pixel:24: error: expected constructor, destructor, or type conversion before ‘(’ token
SMARTMATRIX_ALLOCATE_BUFFERS(matrix, TOTAL_WIDTH, TOTAL_HEIGHT, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
^
a1_single_pixel:25: error: expected constructor, destructor, or type conversion before ‘(’ token
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(bg, TOTAL_WIDTH, TOTAL_HEIGHT, COLOR_DEPTH, kbgOptions);
^
a1_single_pixel: In function ‘void setup()’:
a1_single_pixel:28: error: ‘backgroundLayer’ was not declared in this scope
backgroundLayer.enableColorCorrection(false); // bg is the “background” layer
^
a1_single_pixel:29: error: ‘matrix’ was not declared in this scope
matrix.addLayer(&bg);
^
a1_single_pixel:29: error: ‘bg’ was not declared in this scope
matrix.addLayer(&bg);
^
a1_single_pixel: In function ‘void loop()’:
a1_single_pixel:35: error: ‘bg’ was not declared in this scope
bg.fillScreen({0, 0, 0}); // Clear to a color {r,g,b}
^
‘SMARTMATRIX_HUB75_32ROW_MOD16SCAN’ was not declared in this scope

as I said, my real goal is to use the third example to recieve data via serial, however though i shoud start with the simplest example and see if it works first, to no avail.
anyway, many thanks for your quick response Louis!

I get the same errors as you if I comment out #include <SmartMatrix.h>

Can you paste the complete compilation output? If it’s too big you may need to paste it somewhere else, like gist.github.com

Here’s the full modified sketch that compiles for me:

/**
 * Example 2.
 * Animate some LEDs of a RGB matrix, directly from the controller.
 *
 * For ease of connection a SmartLED Shield is used (but is not strictly necessary):
 * http://docs.pixelmatix.com/SmartMatrix/
 * 
 * The library offers many tools (and examples) to display graphics, animations and texts.
 * Dependencies (and docs):
 * https://github.com/pixelmatix/SmartMatrix
 */

#include <MatrixHardware_Teensy3_ShieldV4.h>
#include <SmartMatrix.h>
#define COLOR_DEPTH 24

const uint16_t TOTAL_WIDTH    = 64;       // Total size of the chained matrices
const uint16_t TOTAL_HEIGHT   = 32;
const uint8_t  kRefreshDepth  = 24;       // Valid: 24, 36, 48
const uint8_t  kDmaBufferRows = 4;        // Valid: 2-4
const uint8_t  kPanelType     = SMARTMATRIX_HUB75_32ROW_MOD16SCAN;
const uint8_t  kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);
const uint8_t  kbgOptions     = (SM_BACKGROUND_OPTIONS_NONE);

SMARTMATRIX_ALLOCATE_BUFFERS(matrix, TOTAL_WIDTH, TOTAL_HEIGHT, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(bg, TOTAL_WIDTH, TOTAL_HEIGHT, COLOR_DEPTH, kbgOptions);

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  bg.enableColorCorrection(false);            // bg is the "background" layer
  matrix.addLayer(&bg);
  matrix.setBrightness(255);
  matrix.begin();
}

void loop() {
  static uint32_t count = 0;                   // Just a counter
  static uint8_t offs_y = TOTAL_HEIGHT / 2;

  bg.fillScreen({0, 0, 0});                    // Clear to a color {r,g,b}

  uint16_t x, y;
  for (uint16_t i = 0; i < TOTAL_WIDTH; i++) { // Draw a sine wave
    x = i;
    y = sin((i + 1) * count * 0.0005) * offs_y + offs_y;
    bg.drawPixel(x, y, {255, 255, 255});      
  }

  bg.swapBuffers();                            // The library offers double buffering
    
  digitalWrite(LED_BUILTIN, count / 10 % 2);   // Let's animate the built-in LED as well
  count++;
}