Hello,
I maked on a mini-project, which is a cube led (no RGB) 4 * 4 * 4 .For finish this project i bought:
- Arduino Mega 2560
- Max 7221
- Capcitor 10 uf and 100nf
resistors, etc. ....
To start I wired 8 LEDs to a max7221, but i have a problem ....
!
First I have the opportunity to use a library 'matrix' or 'ledcontrol' but I would know if this library are more optimized for my project ?
And for my cube i must use external supply and transistor but i don't see wiring ?
Secondly I could turn all the LEDs (8) simultaneously : ( is it a good solution or not ? )
#include <binary.h>
#include <LedControl.h>
#include <SPI.h>
LedControl lc=LedControl(12,11,10,1);
int timer = 1;
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);
}
void loop () {
void setLed(int addr, int row, int col, boolean state);
while (1) {
lc.setLed(0,0,1,true);
delay(timer);
lc.setLed(0,0,1,false);
lc.setLed(0,0,5,true);
delay(timer);
lc.setLed(0,0,5,false);
lc.setLed(0,0,2,true);
delay(timer);
lc.setLed(0,0,2,false);
lc.setLed(0,0,6,true);
delay(timer);
lc.setLed(0,0,6,false);
lc.setLed(0,0,3,true);
delay(timer);
lc.setLed(0,0,3,false);
lc.setLed(0,0,7,true);
delay(timer);
lc.setLed(0,0,7,false);
lc.setLed(0,0,4,true);
delay(timer);
lc.setLed(0,0,4,false);
lc.setLed(0,0,0,true);
delay(timer);
lc.setLed(0,0,0,false);
}
}
Secondly I would like make a scenario:
all LEDs high for 10 seconds
delay 2000ms
LED high 0,1,2,3 for 5 seconds
delay 2000ms
LED high 4,5,6,7
I started this code but I don't see how finish this code
#include <binary.h>
#include <LedControl.h>
#include <SPI.h>
int timer =150;
int temps;
LedControl lc=LedControl(12,11,10,1);
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);
}
void loop () {
void setLed(int addr, int row, int col, boolean state);
if((millis() - temps) < 3000)
{
lc.setLed(0,0,1,true);
delay(timer);
lc.setLed(0,0,1,false);
lc.setLed(0,0,5,true);
delay(timer);
lc.setLed(0,0,5,false);
lc.setLed(0,0,2,true);
delay(timer);
lc.setLed(0,0,2,false);
lc.setLed(0,0,6,true);
delay(timer);
lc.setLed(0,0,6,false);
lc.setLed(0,0,3,true);
delay(timer);
lc.setLed(0,0,3,false);
lc.setLed(0,0,7,true);
delay(timer);
lc.setLed(0,0,7,false);
lc.setLed(0,0,4,true);
delay(timer);
lc.setLed(0,0,4,false);
lc.setLed(0,0,0,true);
delay(timer);
lc.setLed(0,0,0,false);
}
}
thank you !