Answer the question
In order to leave comments, you need to log in
How to make the diodes in the matrix not go out?
There is the following scheme:
Code:
int valX = 0;
int valY = 0;
int fila = 5;
int columna = 13;
int lectura = 0;
int posX = constrain(posX, 0, 5);
int posY = constrain(posY,0,5);
int contX=constrain(contX, 0, 150);
int contY=constrain(contY, 0, 150);
int frame[6][6]=
{
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0},
{0,0,0,0,0,0}
};
void setup()
{
for(int i=0; i<6; i++){
pinMode(i, OUTPUT);
}
for(int i=8; i<14; i++){
pinMode(i, OUTPUT);
}
pinMode(6, INPUT);
pinMode(7, INPUT);
}
void limpiar(){
for(int i=0; i<6; i++){
digitalWrite(i, LOW);
}
for(int i=8; i<14; i++){
digitalWrite(i, HIGH);
}
}
void loop()
{
valX = map(analogRead(5),0,1023,0,6);
valY = map(analogRead(4),0,1023,0,6);
switch(valX){
case 1: if(contX>=100){
frame[posY][posX]=0;
posX--;
frame[posY][posX]=1;
contX=0;
}
case 2: if(contX>=100){
frame[posY][posX]=0;
posX--;
frame[posY][posX]=1;
contX=0;
}
break;
case 5: if(contX>=100){
frame[posY][posX]=0;
posX++;
frame[posY][posX]=1;
contX=0;
}
break;
case 6: if(contX>=100){
frame[posY][posX]=0;
posX++;
frame[posY][posX]=1;
contX=0;
}
break;
}
switch(valY){
case 1: if(contY>=100){
frame[posY][posX]=0;
posY--;
frame[posY][posX]=1;
contY=0;
}
break;
case 2: if(contY>=100){
frame[posY][posX]=0;
posY--;
frame[posY][posX]=1;
contY=0;
}
break;
case 4: if(contY>=100){
frame[posY][posX]=0;
posY++;
frame[posY][posX]=1;
contY=0;
}
break;
case 5: if(contY>=100){
frame[posY][posX]=0;
posY++;
frame[posY][posX]=1;
contY=0;
}
break;
}
for(int scan=0; scan<1; scan++){
for(int i=0; i<6; i++){
digitalWrite(fila-i,HIGH);
for(int j=0; j<6; j++){
if(frame[i][j]==1){
digitalWrite(columna-j, LOW);
}
}
limpiar();
}
}
contX++;
contY++;
}
Answer the question
In order to leave comments, you need to log in
without looking at the code, but simply at the diagram and the task - but as described in the technical specification, strictly speaking, in general - is it possible?
("so that it does not go out" spoils everything somewhat, it is necessary to clarify - "so that it seems that it does not go out"?)
imagine a circuit without a duina, just with toggle switches, on rows and columns. IMHO, it doesn't work.
let's say they gave it to the bottom line, now we went to give it one by one, to the columns - for now, ok, the bottom row is filled in as you wanted, but then - row 2 - we give it to the second line, and we have two full lines on fire ... not one at a time is filled again, and the whole line at once, and then 3,4,5 in the same way ...
Or you need a dynamic display - like on 7 segment indicators, which are many in parallel,
but the matrices are scanned giving a symbol for the position to the common bus, and including the common cathode only for the required matrix.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question