Hello,
I'm programming a MAX7219 8x8 LED matrix on a raspberry pi pico where letters display one after another when a button is pressed. It works perfectly when uploaded onto the pico but when I unplug it and plug it in nothing happens no leds light up at all. I've tried to look at other similar issues online but to no avail.
The following sketch
//MAX7219 - using Led Control library to display 8x8 bitmap
#include <LedControl.h>
int DIN = 28;
int CS = 21;
int CLK = 20;
int button = 18;
int buttonState = 0;
LedControl lc=LedControl(DIN, CLK, CS,0);
boolean buttonVal = false;
int Cat[8] ={0b10001000,0b11111000,0b10101000,0b01110001,0b00100001,0b01111001,0b01111101,0b10111110};
int Heart [8] = {0b00011000, 0b00111100, 0b01111110, 0b11111111, 0b11111111, 0b11111111, 0b01100110, 0b00000000};
int lLetter [8] = {0b00000000, 0b00111100, 0b00111100, 0b00110000, 0b00110000, 0b00110000, 0b00110000, 0b00000000};
int iLetter [8] = {0b00000000, 0b00011000, 0b00011000, 0b00011000, 0b00011000, 0b00011000, 0b00011000, 0b00000000};
int oLetter [8] = {0b00000000, 0b00111100, 0b01111110, 0b01100110, 0b01100110, 0b01111110, 0b00111100, 0b00000000};
int vLetter [8] = {0b00000000, 0b00011000, 0b00111100, 0b01100110, 0b01100110, 0b01100110, 0b01100110, 0b00000000};
int eLetter [8] = {0b00000000, 0b00111100, 0b00110000, 0b00111100, 0b00111100, 0b00110000, 0b00111100, 0b00000000};
int yLetter [8] = {0b00000000, 0b00011000, 0b00011000, 0b00111100, 0b01100110, 0b01100110, 0b01100110, 0b00000000};
int uLetter [8] = {0b00000000, 0b00111100, 0b01111110, 0b01100110, 0b01100110, 0b01100110, 0b01100110, 0b00000000};
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,0);
lc.clearDisplay(0);
pinMode(button, INPUT);
}
void loop(){
buttonState = digitalRead(button); //reads button
if (buttonState == LOW) { // if buttons pressed runs this sequence on the matrix
for(int i=0;i<8;i++) lc.setColumn(0,i,Heart[i]);
delay(1000);
//lc.clearDisplay(0); potentially thought these were the issue but works without it... same issue
for(int i=0;i<8;i++) lc.setColumn(0,i,iLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,lLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,oLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,vLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,eLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,yLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,oLetter[i]);
delay(1000);
//lc.clearDisplay(0);
for(int i=0;i<8;i++) lc.setColumn(0,i,uLetter[i]);
delay(1000);
lc.clearDisplay(0);
}
}
I'm really not sure what could be the issue as I run the Blink example code and it works before and after unplugging and plugging in again.