Arduino Mega , Serial problem

Hello, I've got problem with serial on my Arduino Mega. I can every program where isn't Serial in. E.g led blink.

void setup(){
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

But this code doesn't run at all.

void setup(){
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
  Serial.println("A");
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

Thanks for every reply.

Your Serial1.begin(9600); and Serial.println("A"); statements don't match. They both need to be Serial.... or Serial1.... Depending on which serial port you want to communicate on. The Serial. is the USB link to your PC, Serial1 is a TTL voltage level serial port avalible to wire to external TTL serial devices.

Lefty

Sorry, I'm so stupid but it doesn't solve the problem. My sketch doesn't run anyway.

Can you leave us with any error messages or should we continue guessing in the dark?

My sketch doesn't run anyway.

Does it upload from the IDE OK?

What doesn't run, no serial link or no blink or both? Which serial port did you decide to use? What are you trying to send data to?

Lefty

And, are you opening the Serial Monitor window?

It doesn't run at all. As i wrote in first topic, this sketch

void setup(){
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

compiles, and works without problems.

This sketch

void setup(){
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
  Serial.println("A");
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

uploads OK, but Serial LED is not blinking and LED on pin 13 as well

Your last code example:

void setup(){
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
  Serial.println("A");
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);

}

Works fine in my Seeeduino Mega. The pin 13 led blinks once a second and the 'A' character is sent out the USB serial link and can be seen with the Arduino IDE serial monitor function when set to 9600 baud. Why it doesn't work for you is a mystery to me as the simple blink program proves your pin 13 is functioning fine, and the fact that you can upload a sketch says your USB link is functioning OK.

You don't have anything wired to pins 0 or 1 do you?

Anyone else have a clue?

Lefty

It looks like problem is in my Arduino Mega.
I’m going to send it back to seller.

Thanks for all your replies

Actually, it looks like the same bug as http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250084886