Is it the same "noise" each time?
dbolgheroni@mob-compaq:~$ sudo tip -38400 /dev/ttyU0connectedTCCino v0.1Sending command to reset ELM327... ATZ sent.> gvQÃYÃ)Ã12.3V> gvGÃÃÃ12.3V> gvQÃYÃ)Ã12.3V> gvÃYÃ 12.3V> gvQÃYÃ)Ã12.3V>dbolgheroni@mob-compaq:~$ sudo tip -38400 /dev/ttyU0
If so, perhaps it isn't "noise" at all. Perhaps there is some significance to the values, but not as characters.
You are right, but why don't I get these characters using an UART, e.g. a hardware serial of Mega2560?
Serial.print("Byte: ");Serial.println(t, DEC);
if (t >= ' ') cmdrx[i++] = t;
I see that you set pinMode for the NewSoftSerial pin, AFTER telling NewSoftSerial about the pin. I wouldn't think this advisable.
I also see that you use Serial.flush(). This throws away any data in the input buffer that has not been read yet. Rarely is this a good idea.
computer <--> Arduino* <--> *OBD-II serial cable <--> OBD-II complaint car
When you perform the identical test using the hardware serial port, is the command string, i.e. "atrv" echoed back from the serial device? If so, my theory is that the "noise" you are seeing is this command string being corrupted.
And Paul is correct; you should not touch any pins whose control you have turned over to NewSoftSerial (or any other library, I would think).
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16