Matrix Portal M4 Something wrong???

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Kingfrankbob
 
Posts: 37
Joined: Thu Jul 19, 2018 7:11 pm

Matrix Portal M4 Something wrong???

Post by Kingfrankbob »

Here is the Arduino Config that I am using!
Here is the Arduino Config that I am using!
Screenshot (1).png (219.85 KiB) Viewed 191 times
Greetings,
I had previously opened a forum on this topic, but it only worked for a little bit. I first got a Matrix Portal M4, I used Arduino to program it with my own program, and then one day it started to give up. I tried to do Serial Communication, but it didn't work, it wouldn't even find the built-in accelerometer. I ended up purchasing a second one and now it has the exact same issues. I will upload my code file below! I have an error section for checking whether or not the Serial has started. The red led is now blinking every 1000ms according to my code. As well as not showing up on the current MATRIX with the suggested 5v 4a power supply.
I have tried the following:
  • I have uploaded the program then opened Serial Monitor
  • I have uploaded it in BOOTLOADER Mode, and then tried opening the Serial Monitor
  • I have uploaded it unplugged the device and even restarted Arduino, and it still hasn't worked
I'm kind of stuck, I have all of the requirements on Arduino set/met according to the guides!
Here is the Arduino Config that I am using!
Here is the Arduino Config that I am using!
Screenshot (1).png (219.85 KiB) Viewed 191 times
I'm using a 64x32 Matrix!
Any Ideas or Suggestions?

Code:

Code: Select all

//#include <RGBmatrixPanel.h>

#include <Wire.h>
#include <Adafruit_LIS3DH.h>     
#include <Adafruit_PixelDust.h>  
#include <Adafruit_Protomatter.h>
//#include "RTClib.h"
#include <string.h> 

#define HEIGHT  32 
#define WIDTH   64 
#define MAX_FPS 45 

#if HEIGHT == 64 
uint8_t addrPins[] = {17, 18, 19, 20, 21};
#else            
uint8_t addrPins[] = {17, 18, 19, 20};
#endif

uint8_t rgbPins[]  = {7, 8, 9, 10, 11, 12};
uint8_t clockPin   = 14;
uint8_t latchPin   = 15;
uint8_t oePin      = 16;

int xcoor[] = {0, 2, 2, 4, 6, 6, 4, 4, 6, 6, 4, 2, 2, 0, 0, 0, 2,  2,  0,  0,  0,  2,  2,  4,  4,  6,  6,  6,  4, 4, 6, 8, 10, 10,  8,  8,  8, 10, 10, 12, 12, 14, 14, 14, 12, 12, 14, 14, 14, 12, 12, 10, 8, 8, 10, 10, 8, 8, 10, 12, 12, 14, 14, 16, 18, 18, 16, 16, 16, 18, 18, 20, 20, 22, 22, 22, 20, 20, 22, 24, 24, 26, 26, 28, 30, 30, 28, 28, 30, 30, 28, 26, 26, 24, 24, 24, 24, 26, 26, 28, 30, 30, 28, 28, 30, 30, 28, 26, 26, 24, 24, 22, 20, 20, 22, 22, 22, 20, 20, 18, 18, 16, 16, 16, 18, 18, 16, 16, 18, 18, 16, 16, 16, 18, 18, 20, 20, 22, 22, 22, 20, 20, 22, 24, 24, 26, 26, 28, 30, 30, 28, 28, 30, 30, 28, 26, 26, 24, 24, 24, 24, 26, 26, 28, 30, 30, 28, 28, 30, 30, 28, 26, 26, 24, 24, 22, 20, 20, 22, 22, 22, 20, 20, 18, 18, 16, 16, 16, 18, 18, 16, 14, 14, 12, 12, 10,  8,  8, 10, 10,  8,  8, 10, 12, 12, 14, 14, 14, 12, 12, 14, 14, 14, 12, 12, 10, 10,  8,  8,  8, 10, 10,  8,  6,  4,  4,  6,  6,  6,  4,  4,  2,  2,  0,  0,  0,  2,  2,  0,  0,  0,  2,  2,  4,  6,  6,  4,  4,  6,  6,  4,  2,  2,  0,  0};// XCOOR
int ycoor[] = {2, 2, 0, 0, 0, 2, 2, 4, 4, 6, 6, 6, 4, 4, 6, 8, 8, 10, 10, 12, 14, 14, 12, 12, 14, 14, 12, 10, 10, 8, 8, 8,  8, 10, 10, 12, 14, 14, 12, 12, 14, 14, 12, 10, 10,  8,  8,  6,  4,  4,  6,  6, 6, 4,  4,  2, 2, 0,  0,  0,  2,  2,  0,  0,  0,  2,  2,  4,  6,  6,  4,  4,  6,  6,  4,  2,  2,  0,  0,  0,  2,  2,  0,  0,  0,  2,  2,  4,  4,  6,  6,  6,  4,  4,  6,  8, 10, 10,  8,  8,  8, 10, 10, 12, 12, 14, 14, 14, 12, 12, 14, 14, 14, 12, 12, 10,  8,  8, 10, 10,  8,  8, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 22, 22, 20, 20, 22, 22, 20, 18, 18, 16, 16, 16, 18, 18, 16, 16, 16, 18, 18, 20, 20, 22, 22, 22, 20, 20, 22, 24, 26, 26, 24, 24, 24, 26, 26, 28, 28, 30, 30, 30, 28, 28, 30, 30, 30, 28, 28, 26, 24, 24, 26, 26, 24, 24, 26, 28, 28, 30, 30, 30, 28, 28, 30, 30, 30, 28, 28, 26, 26, 24, 24, 24, 26, 26, 24, 22, 22, 20, 20, 18, 16, 16, 18, 18, 16, 16, 18, 20, 20, 22, 22, 22, 22, 20, 20, 18, 16, 16, 18, 18, 16, 16, 18, 20, 20, 22, 22, 24, 26, 26, 24, 24, 24, 26, 26, 28, 28, 30, 30, 30, 28, 28, 30};// YCOOR


Adafruit_Protomatter matrix(HEIGHT, 4, 1, rgbPins, 4, addrPins, clockPin, latchPin, oePin, false);  

//RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);
/*********************************
MAX OF 34 CHARACTERS

USE WHEEL FUNCTION 

SET TEXT WRAP TO TRUE

https://docs.arduino.cc/built-in-examples/strings/StringIndexOf

*********************************/

void err(int x) {
  uint8_t i;
  pinMode(LED_BUILTIN, OUTPUT);       // Using onboard LED
  for(i=1;;i++) {                     // Loop forever...
    digitalWrite(LED_BUILTIN, i & 1); // LED on/off blink to alert user
    delay(x);
  }
}
void setup() {
  Serial.begin(115200);
  while(!Serial) err(1000);
  matrix.begin();
  matrix.fillRect(0, 0, matrix.width(), matrix.height(), matrix.color565(0, 0, 0));
  matrix.setTextSize(1);
  matrix.setTextWrap(true);

  change = 1;

  matrix.setCursor(0, 0);

  Serial.println("Begin");

  }

void loop() {

for (int i = 0; i < sizeof(xcoor); i++)
{
  if(i < 255){
  matrix.drawLine(xcoor[i], ycoor[i], xcoor[i+1], ycoor[i+1], matrix.color565(2, 100, 32));
  delay(100);
  Serial.println(xcoor[i]+ ", " + xcoor[i+1]);
  }
  if(i == 255) break;
}

}
uint16_t Wheel(byte WheelPos) {
  if(WheelPos < 8) {
   return matrix.color565(255 - (WheelPos * 31.875), (WheelPos * 31.875), 0);
  } else if(WheelPos < 16) {
   WheelPos -= 8;
   return matrix.color565(0, 255 - (WheelPos * 31.875), (WheelPos * 31.875));
  } else if(WheelPos < 24){
   WheelPos -= 16;
   return matrix.color565((WheelPos * 31.875), 0, 255 - (WheelPos * 31.875));
  } else if(WheelPos < 32) {
    WheelPos -= 24;
   return matrix.color565(255 - (WheelPos * 31.875), (WheelPos * 31.875), 0);
  } else if(WheelPos < 40) {
   WheelPos -= 32;
   return matrix.color565(0, 255 - (WheelPos * 31.875), (WheelPos * 31.875));
  } else
   WheelPos -= 40;
   return matrix.color565((WheelPos * 31.875), 0, 255 - (WheelPos * 31.875));
  }

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Matrix Portal M4 Something wrong???

Post by adafruit_support_carter »

Your code is going into an infinite loop if there is no serial connection at start up. You generally can not manually open the serial monitor fast enough to avoid that.

User avatar
Kingfrankbob
 
Posts: 37
Joined: Thu Jul 19, 2018 7:11 pm

Re: Matrix Portal M4 Something wrong???

Post by Kingfrankbob »

Should I put a Delay or something? so it dosent start up so fast?

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Matrix Portal M4 Something wrong???

Post by adafruit_support_carter »

What are you generally trying to do with the Serial Monitor output?

User avatar
Kingfrankbob
 
Posts: 37
Joined: Thu Jul 19, 2018 7:11 pm

Re: Matrix Portal M4 Something wrong???

Post by Kingfrankbob »

Im just trying to troubleshoot my code, I did get it to print by doing on a blank arduino sketch, serial begin in the setup and a serial.println in the void loop

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Matrix Portal M4 Something wrong???

Post by adafruit_support_carter »

Try just adding some

Code: Select all

Serial.println("Some useful message"):
lines in key places.

Anytime you call your err() function, it will enter an infinite loop and no other code will execute.

Code: Select all

      for(i=1;;i++) {                     // Loop forever...
        digitalWrite(LED_BUILTIN, i & 1); // LED on/off blink to alert user
        delay(x);
      }
Either change it, or avoid calling it.

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

Return to “Itsy Bitsy Boards”