Hey! I need some help with a problem I am having when using a serial and a soft serial connection at the same time. First of all for the soft serial connection I am using the USB to TTL Serial Cable from the adafruit store (USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi : ID 954 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits). I have installed all the correct drivers. I am using a Mac running Mountain Lion. I am using an Arduino UNO R3.
What I want to do is send a string using a python script through the soft serial connection and read the string byte by byte on the arduino displaying each value on the serial connection as it reads it.
Here's the code:
Python Script:
import serial
ser = serial.Serial("/dev/tty.PL2303-00001014", 38400)
ser.write("Hello Adafruit")
ser.close()
Arduino Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
Serial.begin(9600);
mySerial.begin(38400);
}
void loop() {
if (mySerial.available() > 0) {
char inByte = mySerial.read();
Serial.write(inByte);
}
}
On the computer I have the serial monitor opened viewing the communication coming to my serial port. The problem is that when I run the python script sending the string through the soft serial connection to the arduino, when I monitor the serial connection I am getting garbage (aÌäê¥Ñ!?) when I am supposed to get the string "Hello Adafruit". The weird thing is that when I try sending the string through the serial connection and displaying it on the serial connection, or sending the string through the soft serial connection and displaying it on the soft serial connection, the string arrives perfectly fine with no errors. I have also tried sending the string through the serial connection and displaying it on the soft serial connection but that does not work (nothing shows up at the serial monitor). I have also tried using various baud rates and using the same baud rate for the serial and soft serial connections and the results are the same.
At this point I have no idea what might be wrong. The only possible thing I can think of is that the cable I received is somehow defective but that does not make much sense since when I am sending the communication through the soft serial connection in order to display it on the soft serial connection it arrives perfectly fine. I need some help. Thank you very much for your time!