I've only been doing this 3 weeks so please have some patience. Some of these things must be easy but they are difficult for me to figure out.
-
more a statement than a question. someone said get in the habit of using lots of variables so that what's i'm trying to do.
-
phantom words, or parts of works show up in the serial monitor. why? how do i fix?
-
why doesn't the serial input wait too long before moving on? is there a way to better control this?
-
it seems like spacing is a problem too. it seems as if i have the same code but the outcome is different.
Coding take a lot of time and attention to detail. If someone forgets to a french fry on my plate, no big deal. If you forgot a semicolon, it can be stop you in you tracks.
BTW: I'm learning with code I found online in help forums, articles and apps. I modify it to learn. You may see your base code. If you do and and you don't want me to use it, I won't.
int dogs = 10;
int hotdogbuns = 100;
int mustard = 100;
int ketchup = 100;
int relish = 100;
int plates = 100;
int variables = 6;
int dogAte = 10; // the number of dogs that ate hot dogs
int bunsAte = 10; // the number of dogs that ate buns
int mustardAte = 4; // only six dogs would eat the hog dogs with mustard
int ketchupAte = 9; // one 1 dog did not likr ketchup
int relishAte = 2; // only two dogs like relish
int (doggyGuess);
String dogAteQ ="How many of the 10 dogs that ate hot dogs?";
String bunsAteQ ="How many of the 10 dogs ate buns?";
String mustardAteQ ="How many of the 10 dogs are hot dohs with mustard?";
String ketchAteQ ="How many of the 10 dogs are hot dohs with ketchup?";
String relishAteQ ="How many of the 10 dogs are hot dohs with relish?";
void setup() { // put your setup code here, to run once:
Serial.begin(9600);
delay (3000);
Serial.print("Ten dogs got togther to have hot dogs.");
Serial.println("");
Serial.println("Some dogs were pickier eaters than others.");
delay(1000);
Serial.print("\n\n");
Serial.print("How many dogs liked ketchup?");
while (Serial.available()==0){ //Wait for input
doggyGuess = Serial.parseInt(); } //Read user input
Serial.print(" In our study ");
Serial.print(ketchupAte);
Serial.print(" out of ");
Serial.print(dogs);
Serial.print(" dogs liked ketchup.");
Serial.print("You picked: ");
Serial.print(doggyGuess);
delay(2000);
Serial.print("Ten dogs got togther to have hot dogs.");
Serial.println("");
Serial.println("Some dogs were pickier eaters than others.");
delay(1000);
Serial.print("\n\n\\n");
Serial.print("How many dogs liked mustard?");
while (Serial.available()==0){ //Wait for input
doggyGuess = Serial.parseInt(); } //Read user input
Serial.print(" In our study ");
Serial.print(mustardAte);
Serial.print(" out of ");
Serial.print(dogs);
Serial.print(" dogs liked mustard.");
Serial.print("You picked: ");
Serial.print(doggyGuess);
delay(2000);
Serial.print("\n\n\\n");
Serial.print("How many dogs liked relish?");
while (Serial.available()==0){ //Wait for input
doggyGuess = Serial.parseInt(); } //Read user input
Serial.print(" In our study ");
Serial.print(relishAte);
Serial.print(" out of ");
Serial.print(dogs);
Serial.print(" dogs liked relish.");
Serial.print("You picked: ");
Serial.print(doggyGuess);
delay(2000);
}
void loop() {
// put your main code here, to run repeatedly:
}
Best,
Tony Perry