uart problem can't receive

I am just trying to send a decimal number but I can't receive anything. Here is my code for send on one Arduino:

// Sends "A"s through the serial port every second

// 'Setup' function
void setup()
  // Start the UART at 9600 bits-per-second (baud)

// Main loop
void loop()
  // Print an through the UART

  // Pause 1 second

Here is my receive for the other Arduino:

int incomingByte = 0;      // for incoming serial data

void setup() {
      Serial.begin(9600);      // opens serial port, sets data rate to 9600 bps

void loop() {

      // send data only when you receive data:
      if (Serial.available() > 0) {
            // read the incoming byte:
            incomingByte =;

            // say what you got:
            Serial.print("I received: ");

Any help is more than welcome!! I know its a simple problem. Oh and I have the tx on one to the rx on the other and vice versa.

Do you have a common "ground" connection ?

yes, i have common ground and vcc.

Maybe try storing the decimal in an integer variable, then sending the variable over serial.

I tried that but I keep getting -1 on the receiving end. I think its that I'm missing the capacitor on pin 3 since I'm using the barebones from modern device and I just built it on a breadboard. I've been connecting the rx after the cap, I'll try before and hopefully that'll fix the problem.

ok I have it working now but when I try sending something I get the same two random variables and then what I sent. Did I burn my arduinos?


2 is the unprintable ASCII control code "STX".

Did you mean Serial.print('2');?

Got it to work. It seems i was type casting it as int instead of char and the single quotes helped too thanks!!