// By Ayush Arya // Woah! I wrote 201 lines of code. // Uncomment the next line if you wanna attach a buzzer too. Try it! //const int buzzer = 12; const int led = 13; char incoming; void setup(){ // Uncomment the next line if you wanna attach a buzzer too. Try it! // pinMode(buzzer, OUTPUT); pinMode(led, OUTPUT); Serial.begin(9600); } void loop(){ if(Serial.available() > 0){ incoming = Serial.read(); } // A: if(incoming == 'A'){ dot(); dash(); } // B: else if(incoming == 'B'){ dash(); dot(); dot(); dot(); } // C: else if(incoming == 'C'){ dash(); dot(); dash(); dot(); } // D: else if(incoming == 'D'){ dash(); dot(); dot(); } // E: else if(incoming == 'E'){ dot(); } // F: else if(incoming == 'F'){ dot(); dot(); dash(); dot(); } // G: else if(incoming == 'G'){ dash(); dash(); dot(); } // H: else if(incoming == 'H'){ dot(); dot(); dot(); dot(); } // I: else if(incoming == 'I'){ dot(); dot(); } // J: else if(incoming == 'J'){ dot(); dash(); dash(); dash(); } // K: else if(incoming == 'K'){ dash(); dot(); dash(); } // L: else if(incoming == 'L'){ dot(); dash(); dot(); dot(); } // M: else if(incoming == 'M'){ dash(); dash(); } // N: else if(incoming == 'N'){ dash(); dot(); } // O: else if(incoming == 'O'){ dash(); dash(); dash(); } // P: else if(incoming == 'P'){ dot(); dash(); dash(); dot(); } // Q: else if(incoming == 'Q'){ dash(); dash(); dot(); dash(); } // R: else if(incoming == 'R'){ dot(); dash(); dot(); } // S: else if(incoming == 'S'){ dot(); dot(); dot(); } // T: else if(incoming == 'T'){ dash(); } // U: else if(incoming == 'U'){ dot(); dot(); dash(); } // V: else if(incoming == 'V'){ dot(); dot(); dot(); dash(); } // W: else if(incoming == 'W'){ dot(); dash(); dash(); } // X: else if(incoming == 'X'){ dash(); dot(); dot(); dash(); } // Y: else if(incoming == 'Y'){ dash(); dot(); dash(); dash(); } // Z: else if(incoming == 'Z'){ dash(); dash(); dot(); dot(); } } void dot(){ digitalWrite(led, HIGH); // Uncomment the next line if you wanna attach a buzzer too. Try it! // digitalWrite(buzzer, HIGH); delay(100); digitalWrite(led, LOW); // Uncomment the next line if you wanna attach a buzzer too. Try it! // digitalWrite(buzzer, LOW); delay(800); } void dash(){ digitalWrite(led, HIGH); // Uncomment the next line if you wanna attach a buzzer too. Try it! // digitalWrite(buzzer, HIGH); delay(1000); digitalWrite(led, LOW); // Uncomment the next line if you wanna attach a buzzer too. Try it! // digitalWrite(buzzer, LOW); delay(800); }