Pages: [1]   Go Down
Author Topic: problem sending correct format data from pc to arduino board  (Read 1265 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi, friends i am trying to send data in form of numbers from my pc to arduino board using the serial monitor, but on echoing back i receive different no. corresponding to each digit. like if i send 100, i get back 49 48 48. plz help me out.
Logged

France
Offline Offline
Sr. Member
****
Karma: 2
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's good !!!

Because 49 is the ascii code for the character '1' and 48 for '0'.

So from, arduino is receiving '100'.

You just have to store it in his decimal value or use a function like atoi(), strtol() or strtoul().


« Last Edit: May 05, 2011, 12:27:06 pm by Grag38 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks so much Grag8, for the prompt reply. i ll  be sure to use these functions.
Logged

Pages: [1]   Go Up
Jump to: