Debugging with Arduino

Hi guys! I'm new in this forum and in Arduino programming. I need to debug my code. I've googled and I saw some example but I can't use it. In particular I've tried to use this code:

setup(){
  //....
  Serial.begin(9600);
  //....
}

loop(){
  //....
  int x=3;
  Serial.println(x);
  //....
}

Thanks in advance and sorry for my bad english

Look up 3 at www.asciitable.com. Likely it's not a printable character.

Perhaps try char x='3';

3 3 3 3 3

Syntax errors aside, your code works for me. It's not very much debugging though, just printing 3 forever.

My tell us what you're trying to do, and how it's not working for you.

CrossRoads: Look up 3 at www.asciitable.com. Likely it's not a printable character.

Perhaps try char x='3';

So I can't see directly the value of the variable, but I have to convert in char before. In C to print a value I've used: printf("%d",x); But I think that in Arduino it isn't the same. Serial.println() remember me the JAVA function. Is it the same? So for example if I need to print the value of variable I have to use Serial.println(""+x);