Pages: [1]   Go Down
Author Topic: Serial comunication problem  (Read 224 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm relatively new to Arduino, but I know this isn't supposed to happen... I'm testing my serial because I was getting false inputs when I'd type a serial phrase... I set up this echo script from online sources and any time I type 1 it returns a 1 like it should but also a -38 on the next line immediately after... The -38 becomes 10 if I don't include the subtraction

void setup()

void loop()
 while (Serial.available() == 0);

 int val = - '0';   /*<<<----- this subtraction changes the false value from -38 to 10 if it is not here.  */

Arduino UNO R3
HP touchsmart TM2 running win7 64bit
« Last Edit: November 14, 2012, 02:22:18 pm by D0p3n1nja » Logged

Global Moderator
Offline Offline
Brattain Member
Karma: 309
Posts: 26527
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ASCII "line-feed" (LF) character has the decimal value 10

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: