Simple Serial Sketch:

/*
This is a little sketch that just grabs data from the serial monitor
and tells you what it got. Gives me a simple space to try to understand
what happens in the setup and loop parts...

The mental model I'm using is that there is a 'mailbox' on the serial
monitor that gets checked each time the Serial.available call is run. If
no mail Serial.available returns a 0 and if there is 'mail' then it returns
a 1. This return value is tested in some sort of conditional statement that
preceeds the Serial.read which 'opens' the mail.

To test my understanding I enter various characters into the serial monitor
input line and watch when and how the sketch responds. This helped develop my
understanding...serialData is a future project to figure out how to input
numerical data into the sketch through the serial monitor.

Bruce Emerson 10/21/17
*/

int serialData = 0; // I want to explore inputing a # for a pinout
char chRead = 'n'; // my choice of name for the input from serial monitor

void setup()
{
Serial.begin(9600);
while (! Serial);
Serial.println("Anytime you want to enter data type 'Y' or 'y' into monitor");
}

void loop()
{
Serial.print("Top of loop: chRead: "); // Lets me know when I hit top of loop
Serial.println(chRead); // tracks chRead value
if (Serial.available()){ // watching to see if something shows up
// in the mail box. In the meantime keep on
// keeping on.....

Serial.println("dropped through: "); // Shouldn't show up until after input
delay (2000); // pause so I can notice
chRead = Serial.read(); // read data in 'mailbox'
if (chRead == 'Y' || chRead == 'y'){ // goes on to print if Y OR y
Serial.print("chRead: ");
Serial.print(chRead);
Serial.print(" -- ");
Serial.println(serialData);
delay (2000); // pause so I can notice
}
}

Serial.println("below 'if' loop");
delay(4000); // slows down the speed of loop

}