This thread can contain some useful information: Serial Input Basics - updated.
If you're waiting for a single character, you can use something based on one of the below
void loop()
{
// read from serial
int c = Serial.read();
// check if 'A' is received
if (c == 'A')
{
do something
}
else
{
if (c == -1)
{
// there was nothing to read
}
}
}
Or
void loop()
{
if(Serial.available() > 0)
{
// read from serial
byte c = Serial.read();
// check if character 'a' is received
if (c == 'a')
{
do something
}
}
else
{
// there was nothing to read
}
}