void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Welcome to the F1 driving simulator");
delay(1000);
Serial.println("You will need to answer 5 question in order to proceed");
delay(1000);
Serial.println("Answer 3/5 questions correctly to play the game");
delay(1000);
Serial.println("Press 1 or 2 to choose the set of questions");
delay(1000);
Serial.println("------------------------------------------------------");
delay(1000);
Serial.println("");
}
void loop()
{
if (Serial.available())
{
char set = Serial.read();
Serial.println("First Set");
Serial.println("");
delay(2000);
if(set == '1')
{
Serial.println("The charge of an electron is");
Serial.println("A) 9.21 x 10^-37 kg");
Serial.println("B) 1.759 x 10^11 C/kg");
Serial.println("C) 1.6 x 10^-19 C");
Serial.println("D) 1.6 x 10^-19 J");
delay(2000);
char var = Serial.read();
if(var == 'c')
{
Serial.println("Right answer!");
}
else
{
Serial.println("Wrong answer!");
}
}
else if(set == '2')
{
//do that
}
}
}
This code works halfway, can't input the answers.
How to proceed from here? To input either "a", "b", "c" or "d" as answers for the next step
