README, a bit of optimisation and gitignore
This commit is contained in:
parent
e25651ca3c
commit
8789a0d161
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Makefile
|
||||||
|
build*/*
|
|
@ -29,27 +29,19 @@ const byte ICtable[9]={
|
||||||
B00000000 //une façon de boucler sur 0
|
B00000000 //une façon de boucler sur 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
void selectIC(int outputPin){
|
|
||||||
|
|
||||||
//for (int i=0; i<3; i++){
|
|
||||||
// digitalWrite(ICPins[i], ICtable[outputPin][i]);
|
|
||||||
//}
|
|
||||||
|
|
||||||
PORTB=ICtable[outputPin];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void writeCube(int tdelay){
|
void writeCube(int tdelay){
|
||||||
static int currentLayer=0;
|
static int currentLayer=0;
|
||||||
unsigned long startedAt = millis();
|
unsigned long startedAt = millis();
|
||||||
while(millis() - startedAt < tdelay){
|
while(millis() - startedAt < tdelay){
|
||||||
|
|
||||||
delay(1);// wait a bit on previous layer
|
delay(1);// wait a bit on previous layer
|
||||||
|
digitalWrite(layersPins[currentLayer],LOW);//turn off current Layer
|
||||||
|
|
||||||
//turn off all layers
|
//change currentLayer
|
||||||
for(int pin=0; pin<8; pin++){
|
if(currentLayer == 8)
|
||||||
digitalWrite(layersPins[pin],LOW);
|
currentLayer=0;
|
||||||
}
|
else
|
||||||
|
currentLayer++;
|
||||||
|
|
||||||
digitalWrite(pinOE, HIGH);//Output Enabled off
|
digitalWrite(pinOE, HIGH);//Output Enabled off
|
||||||
//lines
|
//lines
|
||||||
|
@ -59,19 +51,12 @@ void writeCube(int tdelay){
|
||||||
for (int led=0;led <8;led++){
|
for (int led=0;led <8;led++){
|
||||||
digitalWrite(busPins[led], cube[currentLayer][ligne][led]);
|
digitalWrite(busPins[led], cube[currentLayer][ligne][led]);
|
||||||
}
|
}
|
||||||
PORTB=ICtable[ligne +1]; //74HC574 is writed when clock pin goes LOW to HIGH. SO go to the next value for IC.
|
PORTB=ICtable[ligne +1]; //74HC574 is writen when clock pin goes LOW to HIGH. SO go to the next value for IC.
|
||||||
}
|
}
|
||||||
|
|
||||||
//OE ON
|
//OE ON
|
||||||
digitalWrite(pinOE, LOW);
|
digitalWrite(pinOE, LOW);
|
||||||
//layer on
|
//layer on
|
||||||
digitalWrite(layersPins[currentLayer],HIGH);
|
digitalWrite(layersPins[currentLayer],HIGH);
|
||||||
|
|
||||||
//change currentLayer
|
|
||||||
if(currentLayer == 8)
|
|
||||||
currentLayer=0;
|
|
||||||
else
|
|
||||||
currentLayer++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void fillCube(){
|
void fillCube(){
|
||||||
|
@ -107,17 +92,6 @@ void setup(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
/*
|
|
||||||
for (int i=0;i<8;i++){
|
|
||||||
for(int j=0;j<8;j++){
|
|
||||||
for(int k=0;k<8;k++){
|
|
||||||
cube[i][j][k]=HIGH;
|
|
||||||
writeCube(100);
|
|
||||||
cube[i][j][k]=LOW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//remplir tout le layer haut
|
//remplir tout le layer haut
|
||||||
for(int i=0;i<8;i++){
|
for(int i=0;i<8;i++){
|
||||||
for(int j=0;j<8;j++){
|
for(int j=0;j<8;j++){
|
||||||
|
@ -148,7 +122,4 @@ void loop(){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
6
README.md
Normal file
6
README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Arduino's low level code for cube led 8x8x8
|
||||||
|
|
||||||
|
Simplifying the code founded everywhere.
|
||||||
|
|
||||||
|
|
||||||
|
Read [Electronique et Code de bas niveau du cube led 8x8x8](https://blog-du-grouik.tinad.fr/post/Code-de-bas-niveau-du-cube-led-8x8x8) on my web blog for more explanations.
|
Loading…
Reference in New Issue
Block a user