Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. void setup() {
  2.   Serial.begin(9600);
  3. }
  4.  
  5. void loop() {
  6.   if(Serial.available() > 0){
  7.     switch(Serial.read()){
  8.       case '1':
  9.         Serial.println("You have pressed one");
  10.         break;
  11.       case '2':
  12.         Serial.println("You have pressed two");
  13.         break;
  14.       case '3':
  15.         Serial.println("You have pressed three");
  16.         break;
  17.      default:
  18.         Serial.println("Try sending numbers like 1 or 2 or 3..");
  19.         break;
  20.     }//end switch case
  21.   }//end if
  22. }//end loop