serial communication

deba168
Posts: 7
Joined: Tue Nov 27, 2012 3:03 pm

serial communication

Postby deba168 » Tue Dec 11, 2012 2:10 pm

The result I got is :
49
10
by pressing 1 on key board



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

void loop()
{


if (Serial.available() > 0) {
int val= Serial.read();
Serial.println(val);
}
}
abhimanyu
Posts: 94
Joined: Tue Oct 18, 2011 9:49 pm

Re: serial communication

Postby abhimanyu » Tue Dec 11, 2012 2:29 pm

The code seems to be fine.
When you press any key on the KeyBoard, its ASCII character is sent to the Serial Monitor.
Arduino's Serial Monitor has four different choices to display results:
No Line Ending
New Line (NL)
Carriage Return (CR)
Both NL and CR

The additional '10' is for New Line. Similarly, '13' is for Carriage Return. If you do not want any additional character to be displayed, select No Line Ending.

Hope that clarifies your Output.
deba168
Posts: 7
Joined: Tue Nov 27, 2012 3:03 pm

Re: serial communication

Postby deba168 » Fri Dec 14, 2012 4:50 pm

thank you...

Return to “Sensors”

Who is online

Users browsing this forum: No registered users and 1 guest