Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- if(Serial.available() > 0){
- switch(Serial.read()){
- case '1':
- Serial.println("You have pressed one");
- break;
- case '2':
- Serial.println("You have pressed two");
- break;
- case '3':
- Serial.println("You have pressed three");
- break;
- default:
- Serial.println("Try sending numbers like 1 or 2 or 3..");
- break;
- }//end switch case
- }//end if
- }//end loop
Advertisement
Add Comment
Please, Sign In to add comment