Arduino to Serial Cable Encoding Error

I am trying to send data between an Arduino Uno and a Mac.

The Arduino Uno is running this simple sketch to print data to serial:

int redButtonState = 0;
int redButton = 4;

void setup() {
    Serial.begin(19200, SERIAL_8N1);
}

void loop() {
 redButtonState = digitalRead(redButton);
 String x = "Hello";
 if (redButtonState == LOW) {
  Serial.print(x);
  delay(1000);
   }
}

I have a USB to Serial Cable plugged into the Mac. The Serial Cable Tx and Rx are connected to the Tx and RX on the Arduino Uno.

I expect to see "Hello" in Cool Term, instead I get this:

I have also tried goSerial with Similar results, both were setup to 19200, 8 data bits, no parity and 1 stop bits.

Generally the TX line of one device is connected to the RX line of another device, and vice versa. Give that a try.

Hi, Yep tried switching the wires over, then I get no output.

I've tried switching the baud rate, then I get different, but still incorrect output.

It sure looks like a baud rate mismatch. Try a slower speed like 9600 and boost the speed once you get it working at the lower speed.

Thanks for your help.

I've just tried going down to 300. I get a different, but still corrupt output :frowning:

On the computer side, I'm using one of these: http://www.maplin.co.uk/usb-to-serial-9-pin-male-adaptor-29968 Am I right I thinking I only need Tx and Rx wired up. Nothing else?

deplorableword:
On the computer side, I'm using one of these: Maplin Electronics | Batteries, Cables, Chargers, Cameras, Lighting Am I right I thinking I only need Tx and Rx wired up. Nothing else?

Since it has a 9-pin serial connector is is almost certainly using RS232 signaling levels. Those can damage your Arduino. You should use a USB-to-TTL-Serial adapter which uses 0V and 5V signaling, like the one built into your Arduino UNO.

Ah I see, so because it's the wrong voltage the Arduino can't make sense of it?

deplorableword:
Ah I see, so because it's the wrong voltage the Arduino can't make sense of it?

RS232 signaling uses -3V to -12V for HIGH and +3V to +12V for LOW. The Absolute Maximum Ratings for an Arduino I/O pin are pins are -0.5V to VCC+0.5V (5.5V). The RS232 signals go well outside those ranges. If you could limit the voltages to meet the Arduino limits you would still be left with the problem of the data being inverted.