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
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));
}