I am using a atmega328p and a max7219. I have the LEDControl library and it is just not working correctly. I was getting weird results with this and I decided to go to the basics and just have the 2 chips and the 7 segment display. I am using the LCDemo7Segment sketch for testing and all the digits are displaying the same thing at the same time. I am pretty sure I have the wires connected correctly. Display 1 (far left) to pin 2 (DIG 0), Display 2 to pin 11 (DIG 1), etc. I have a 4 display 7 segment display connected to it.
Did not know I needed to add it as it is an example. I have only changed the pins for my configuration.
//We always have to include the library
#include "LedControl.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 6 is connected to the DataIn
pin 7 is connected to the CLK
pin 8 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(6,7,8,1);
/* we always wait a bit between updates of the display */
unsigned long delaytime=250;
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
/*
This method will display the characters for the
word "Arduino" one after the other on digit 0.
*/
void writeArduinoOn7Segment() {
lc.setChar(0,0,'a',false);
delay(delaytime);
lc.setRow(0,0,0x05);
delay(delaytime);
lc.setChar(0,0,'d',false);
delay(delaytime);
lc.setRow(0,0,0x1c);
delay(delaytime);
lc.setRow(0,0,B00010000);
delay(delaytime);
lc.setRow(0,0,0x15);
delay(delaytime);
lc.setRow(0,0,0x1D);
delay(delaytime);
lc.clearDisplay(0);
delay(delaytime);
}
/*
This method will scroll all the hexa-decimal
numbers and letters on the display. You will need at least
four 7-Segment digits. otherwise it won't really look that good.
*/
void scrollDigits() {
for(int i=0;i<13;i++) {
lc.setDigit(0,3,i,false);
lc.setDigit(0,2,i+1,false);
lc.setDigit(0,1,i+2,false);
lc.setDigit(0,0,i+3,false);
delay(delaytime);
}
lc.clearDisplay(0);
delay(delaytime);
}
void loop() {
writeArduinoOn7Segment();
scrollDigits();
}
It was not mentioned in the instructions. I was taking a guess and trying to save some space and everyone's time as it is an example.
I still need help. I just redid my wiring and it was correct. I have tried different pins and no luck.Both of my max7219s are doing this. I have tried using a atmega328 and arduino mega 2560. The videos online show a very different display than mine. I have no clue why this is happening. Only thing that is off from other sources is that there should be a resistor between 5v and ISET. When anything is connected to ISET everything stays on and looks like the code is not running, but right as it is removed I get the same problem. I am using a 10k as that is what is recommended.