Hello friends, I am trying to get a better understanding of using the if statements and decided that a good way to learn would be to write a program that asked the user a question of which room he was starting in and then would ask where his destination room would be. By having different starting rooms to choose and different rooms to end, I figured that the if statement would be used many times. For the time being I'm getting an error that says 'ser' was not declared in this scope . I only posted 2 rooms to start in just to get the program started. I figured the rest would be similar repetition of the above. If anyone can direct me, please help. Eventually I would like to have the Arduino compute the distances, but for now i'll take care of it this way. Thanks for reading
Here's what I have so far.......
// Room Distance Program
void setup()
{ Serial.begin(9600);
Serial.print("Room Distance Program");
delay(3000);
Serial.print("Your starting point options are the following: Gerardo Room, Living Room, Kitchen, Bathroom, Mom Room.....Choose one....");
}
void loop()
{ if(Serial.available())
char ser = Serial.read();
{ if(ser == "Gerardo Room")
{ Serial.print("Gerardo Room"); delay(2000);
{ Serial.print("What is your ending point"); delay(500);}
if(ser == 'Living Room')
{Serial.print("15 feet");}
if(ser == 'Kitchen')
{Serial.print("18");}
if(ser == 'Bathroom')
{Serial.print("23");}
if(ser == 'Moms Room')
{Serial.print("25");}
}
if(ser == 'Living Room')
Serial.print("Living Room"); delay(2000);
{Serial.print('Which room is your ending point');
if(ser == 'Gerardo Room')
{Serial.print("15");}
if(ser == 'Living Room')
{Serial.print("0");}
if(ser == 'Kitchen')
{Serial.print("27");}
if(ser == 'Bathroom')
{Serial.print("32");}
if(ser == 'Moms Room')
{Serial.print("34");}
}}}