Go Down

Topic: Serial.println (Read 678 times) previous topic - next topic

000

Hi guys this my first post in this forum. i am a totally a newbie just starting out into the world of electronics. i had bought a arduino board couple of days back and was testing various functionalities...
well here is the problem...
I want to give a value to the arduino then  try to print that value in the serial monitor from the board(just trying... :)) here is the code i wrote...

int a;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
 if(Serial.available()>0)
   {  a=Serial.read();
      Serial.println(a);
   }
}


well everything works fine.... but whenever i give value in serial monitor , its ASCII value is being displayed... :-? i knw its ASCII value is the one to be displayed... but say if want it to print the same data i give in the same format... like if i give 1 it should show 1 and not 49...
and also say i gave a string "Arduino" it should print that...
can anyone plz tell me how i can do this???
Thanx in advance....
:)

mikalhart

000,

Try this:

Serial.println(a, BYTE);

Mikal

000

thanx mate it works....  :)

Go Up