coding for serial reception of a character from PC to Arduino mega2560

Can anyone share coding for serial reception of a character from PC to Arduino mega2560 microcontroller.. I urgently need this .....

There are examples provided with the IDE.

if (Serial.available() >0){
byte incomingByte = Serial.read();
// now do something with incomingByte
}

thank you so much sir... but i need full programming code for serial communication reception of a character from PC to ARDUINO MEGA2560 micro controller

See reply #1

sir i need programming code for coding for serial reception of a character from PC to Arduino mega2560 microcontroller... i urgently need code sir...

karthikeyan:
sir i need programming code for coding for serial reception of a character from PC to Arduino mega2560 microcontroller... i urgently need code sir...

Which part do you not understand about look in the examples in the IDE - specifically SerialCallResponse

Craig

hi sir,
Could you send program for serial reception of an any character from PC to Arduino mega 2560 microcontroller as soon as possible

 val = Serial.read();

Now what exactly do you want to do?

@OP will you please stop posting the same question over and over again in different parts of the forum?

This is called cross-posting, and it is a shortcut to banning.

Topic merged.

There seems to be a rush of these sort of questions today. I wonder if it is an assignment?

There seems to be a rush of these sort of questions today.

Mostly from the same member, it would seem.

Very simple code for capturing one or more characters sent via the serial monitor.

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial test 0021"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    readString="";
  } 
}

AWOL:

There seems to be a rush of these sort of questions today.

Mostly from the same member, it would seem.

There was also the one in the robotics forum earlier this week - maybe check IP addresses and see if they are one and the same ? This guys seems to have the same tone and registered around the same time

Craig