Guest User

Untitled

a guest
Dec 10th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. //Program 2018121002GreenHackersArduinoBaydin.ino
  2. //Programmer Dr. Aung Win Htut
  3. //Date: 20181210:1538
  4. int iAns = 0;
  5. void setup() {
  6. Serial.begin(9600);
  7. Serial.println("Green Hackers Arduino Baydin");
  8. Serial.println("****************************");
  9. Serial.println("Please Type Your Name in Serial Monitor!");
  10.  
  11. }
  12.  
  13. void loop() {
  14. if (Serial.available() > 0) {
  15. char inChar = (char)Serial.read();
  16. iAns += inChar;
  17.  
  18. if (inChar == '\n') {
  19. switch (iAns % 9)
  20. {
  21. case 0: Serial.println("Your luck is zero, Take care!"); break;
  22. case 1: Serial.println("You will be bitten by a dog"); break;
  23. case 2: Serial.println("You should be careful in driving"); break;
  24. case 3: Serial.println("You will be sick soon!"); break;
  25. case 4: Serial.println("You will lost your phone"); break;
  26. case 5: Serial.println("You will meet your old friend soon!"); break;
  27. case 6: Serial.println("You will found a treasure soon!"); break;
  28. case 7: Serial.println("You will pass your exam easily!"); break;
  29. case 8: Serial.println("You crush will call you soon!"); break;
  30. case 9: Serial.println("Your are so LUCKY, you will win the lottery!"); break;
  31. }
  32. iAns = 0;
  33. Serial.println();
  34. Serial.println("Green Hackers Arduino Baydin");
  35. Serial.println("****************************");
  36. Serial.println("Please Type Your Name in Serial Monitor!");
  37. }
  38. }
  39. }
Add Comment
Please, Sign In to add comment