Skip to content

Instantly share code, notes, and snippets.

@AungWinnHtut
Created December 10, 2018 09:20
Show Gist options
  • Save AungWinnHtut/0d603f39b63b67a87266892547755832 to your computer and use it in GitHub Desktop.
Save AungWinnHtut/0d603f39b63b67a87266892547755832 to your computer and use it in GitHub Desktop.
Program 2018121002GreenHackersArduinoBaydin.ino
//Program 2018121002GreenHackersArduinoBaydin.ino
//Programmer Dr. Aung Win Htut
//Date: 20181210:1538
int iAns = 0;
void setup() {
Serial.begin(9600);
Serial.println("Green Hackers Arduino Baydin");
Serial.println("****************************");
Serial.println("Please Type Your Name in Serial Monitor!");
}
void loop() {
if (Serial.available() > 0) {
char inChar = (char)Serial.read();
iAns += inChar;
if (inChar == '\n') {
switch (iAns % 9)
{
case 0: Serial.println("Your luck is zero, Take care!"); break;
case 1: Serial.println("You will be bitten by a dog"); break;
case 2: Serial.println("You should be careful in driving"); break;
case 3: Serial.println("You will be sick soon!"); break;
case 4: Serial.println("You will lost your phone"); break;
case 5: Serial.println("You will meet your old friend soon!"); break;
case 6: Serial.println("You will found a treasure soon!"); break;
case 7: Serial.println("You will pass your exam easily!"); break;
case 8: Serial.println("You crush will call you soon!"); break;
case 9: Serial.println("Your are so LUCKY, you will win the lottery!"); break;
}
iAns = 0;
Serial.println();
Serial.println("Green Hackers Arduino Baydin");
Serial.println("****************************");
Serial.println("Please Type Your Name in Serial Monitor!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment