Go Down

Topic: Receiving junk info from serial monitor (Read 1 time) previous topic - next topic

RJDR

I'm just starting out with arduino. Right now im trying to get an arduino Mega clone to print out the values contained in an 8x8 bidimentional array. everything seems to be working out just fine, but instead of printing the information, the only thing I can see i a series of junk info formatted as I have specified in my code (8 characters, newline, 8 characters, and so on) what could I be getting wrong?

I'm using an arduino mega clone with arduino IDE0022 under windows xp.

Code: [Select]
int valor; //para mostrar el punto de la matriz
int x; //para recorrer filas
int y; //para recorrer columnas

//nuestro matriz
byte tablilla[8][8]={
 {0,0,0,0,0,0,0,0},
 {0,1,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,0,0},
 {0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0}
                 
};
void setup() {

//comenzamos con el puerto serial
Serial.begin(9600);
}

void loop() {
 
 for(y=0;y<8;y++){  //columnas
 Serial.println(); //una columna nueva
   
   for(x=0;x<8;x++){  //filas
     valor=tablilla[x][y]; //guardamos todo en una variable
     Serial.write(tablilla[x][y]);  //mostramos ese valor
   }
 }

//limpiamos la pantalla
Serial.print(27,BYTE);   //tecla "esc"
Serial.print("[2J");   //clrs
}

MikMo


RJDR

thanks, actually i switched to using

Code: [Select]
Serial.print(tablilla[x][y]);

My error was in thinking that the "Serial.write()" was used to send just one character, it does, but it sends it in binary form. I'm much better off using the "Serial.print()"

Go Up