Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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!");
- }
- }
- }
Add Comment
Please, Sign In to add comment