Project showcase
Pushbutton Piano

Pushbutton Piano

This 13 key Pushbutton Piano will play in any octave from C2-C7 (i.e. C2-C3, F#5-F#6, etc.) and uses a binary count to change semitones.

  • 1,537 views
  • 2 comments
  • 6 respects

Components and supplies

About this project


13 key pushbutton piano plays C4 - C5 at binary 00, all lights off.

  • 6 switches allow transposing from C2 - C7
  • 6 LEDs indicate which switches are on
  • Transposition goes up one ½ step using binary to count
  • Blue LED is MSB, Red LED is LSB

For my non-music peeps, here's a little lesson in transposition:

  • Transposing a note one ½ step up means going from C4 to C#4 (C sharp)
  • Transposing a hole step is going from C4 to D4
  • Transposing an octave is going from C4 to C5


https://drive.google.com/file/d/0B7zbvNsfBFWrcUtEVWZpeHYyWEE/view?usp=sharing




Code

Pushbutton ProgramC/C++
#include "pitches.h"
const int buttonPin1 = 13;    //C
  const int buttonPin2 = 12;  //CS
  const int buttonPin3 = 11;  //D
  const int buttonPin4 = 10;  // DS
  const int buttonPin5 = 9;   // E
  const int buttonPin6 = 8;   //F
  const int buttonPin7 = 7;   //FS
  const int buttonPin8 = 6;   //G
  const int buttonPin9 = 5;   //GS
  const int buttonPin10 = 4;  //A
  const int buttonPin11 = 3;  //AS
  const int buttonPin12 = 2;  //B
  const int buttonPin13 = 1;  //C
const int dip1 = A0; // LSB, 1
  const int dip2 = A1;// 2
  const int dip3 = A2;// 3
  const int dip4 = A3;// 4
  const int dip5 = A4;// 5
  const int dip6 = A5; //MSB, 6
int dip1state = 0;
  int dip2state = 0;
  int dip3state = 0;
  int dip4state = 0;
  int dip5state = 0;
  int dip6state = 0;
int buttonState1 = 0; 
  int buttonState2 = 0;
  int buttonState3 = 0; 
  int buttonState4 = 0;
  int buttonState5 = 0; 
  int buttonState6 = 0;
  int buttonState7 = 0; 
  int buttonState8 = 0;
  int buttonState9 = 0; 
  int buttonState10 = 0;
  int buttonState11 = 0; 
  int buttonState12 = 0;
  int buttonState13 = 0; 


void setup() {

pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  pinMode(buttonPin5, INPUT);
  pinMode(buttonPin6, INPUT);
  pinMode(buttonPin7, INPUT);
  pinMode(buttonPin8, INPUT);
  pinMode(buttonPin9, INPUT);
  pinMode(buttonPin10, INPUT);
  pinMode(buttonPin11, INPUT);
  pinMode(buttonPin12, INPUT);
  pinMode(buttonPin13, INPUT);
pinMode(dip1, INPUT);
  pinMode(dip2, INPUT);
  pinMode(dip3, INPUT);
  pinMode(dip4, INPUT);
  pinMode(dip5, INPUT);
  pinMode(dip6, INPUT);
}

void loop(){
// read the state of the pushbutton value:
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);
buttonState5 = digitalRead(buttonPin5);
buttonState6 = digitalRead(buttonPin6);
buttonState7 = digitalRead(buttonPin7);
buttonState8 = digitalRead(buttonPin8);
buttonState9 = digitalRead(buttonPin9);
buttonState10 = digitalRead(buttonPin10);
buttonState11 = digitalRead(buttonPin11);
buttonState12 = digitalRead(buttonPin12);
buttonState13 = digitalRead(buttonPin13);
dip1state = digitalRead(dip1);
dip2state = digitalRead(dip2);
dip3state = digitalRead(dip3);
dip4state = digitalRead(dip4);
dip5state = digitalRead(dip5);
dip6state = digitalRead(dip6);


if (dip1state == LOW        //00 or 19 in HEX; C4
      && dip2state == LOW
      && dip3state == LOW
      && dip4state == LOW
      && dip5state == LOW
      && dip6state == LOW
      || dip1state == HIGH
      && dip2state == LOW
      && dip3state == LOW
      && dip4state == HIGH
      && dip5state == HIGH
      && dip6state == LOW )
  { if (buttonState1 == LOW) {
    tone(0, NOTE_C4);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_CS4);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_D4);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_DS4);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_E4);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_F4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_FS4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_G4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_GS4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_A4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_AS4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_B4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_C5);}
                           else {
                            noTone(0); }
                        }

 else if  (dip1state == HIGH        //01 in HEX; C2
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)

{ if (buttonState1 == LOW) {
    tone(0, NOTE_C2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_CS2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_D2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_DS2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_E2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_F2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_FS2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_G2);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_GS2);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_A2);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_AS2);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_B2);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_C3);}
                           else {
                            noTone(0); }
                        }
 else if  (dip1state == LOW        //02 in HEX; CS2
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)
 
 {if (buttonState1 == LOW) {
    tone(0, NOTE_CS2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_D2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_DS2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_E2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_F2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_FS2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_G2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_GS2);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_A2);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_AS2);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_B2);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_C3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_CS3);}
                           else {
                            noTone(0); }
                        }
 else if  (dip1state == HIGH       // 03 in HEX; D2
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)
 
{if (buttonState1 == LOW) {
tone(0, NOTE_D2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_DS2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_E2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_F2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_FS2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_G2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_GS2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_A2);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_AS2);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_B2);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_C3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_CS3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_D3);}
                                else {
                                  noTone(0); }
                            }


   else if  (dip1state == LOW        // 04 in HEX DS2
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)


    {if (buttonState1 == LOW) {
    tone(0, NOTE_DS2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_E2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_F2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_FS2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_G2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_GS2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_A2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_AS2);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_B2);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_C3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_CS3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_D3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_DS3);}
                                else {
                                  noTone(0); }
                            }
  



else if  (dip1state == HIGH         // 05 in HEX; E2
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)

{if (buttonState1 == LOW) {
    tone(0, NOTE_E2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_F2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_FS2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_G2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_GS2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_A2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_AS2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_B2);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_C3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_CS3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_D3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_DS3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_E3);}
                                else {
                                  noTone(0); }
                            }



 else if  (dip1state == LOW           // 06 in HEX; F2
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)

{if (buttonState1 == LOW) {
    tone(0, NOTE_F2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_FS2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_G2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_GS2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_A2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_AS2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_B2);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_C3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_CS3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_D3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_DS3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_E3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_F3);}
                                else {
                                  noTone(0); }
                            }


else if  (dip1state == HIGH         // 07 in HEX; FS2
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == LOW
            && dip6state == LOW)
{if (buttonState1 == LOW) {
    tone(0, NOTE_FS2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_G2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_GS2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_A2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_AS2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_B2);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_C3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_CS3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_D3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_DS3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_E3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_F3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_FS3);}
                                else {
                                  noTone(0); }
                            }
            
 else if  (dip1state == LOW      // 08 in HEX; G2
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
{if (buttonState1 == LOW) {
    tone(0, NOTE_G2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_GS2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_A2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_AS2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_B2);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_C3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_CS3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_D3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_DS3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_E3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_F3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_FS3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_G3);}
                                else {
                                  noTone(0); }
                            }


  else if  (dip1state == HIGH       // 09 in HEX; GS2
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
 {if (buttonState1 == LOW) {
    tone(0, NOTE_GS2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_A2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_AS2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_B2);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_C3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_CS3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_D3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_DS3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_E3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_F3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_FS3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_G3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_GS3);}
                                else {
                                  noTone(0); }
                            }           

else if  (dip1state == LOW        // 0A in HEX; A2
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
 {if (buttonState1 == LOW) {
    tone(0, NOTE_A2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_AS2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_B2);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_C3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_CS3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_D3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_DS3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_E3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_F3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_FS3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_G3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_GS3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_A3);}
                                else {
                                  noTone(0); }
                            }              

else if  (dip1state == HIGH     // 0B in HEX; AS2
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
 {if (buttonState1 == LOW) {
    tone(0, NOTE_AS2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_B2);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_C3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_CS3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_D3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_DS3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_E3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_F3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_FS3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_G3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_GS3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_A3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_AS3);}
                                else {
                                  noTone(0); }
                            }  
                            
 else if  (dip1state == LOW        // 0C in HEX; B2
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
 {if (buttonState1 == LOW) {
    tone(0, NOTE_B2);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_C3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_CS3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_D3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_DS3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_E3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_F3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_FS3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_G3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_GS3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_A3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_AS3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_B3);}
                                else {
                                  noTone(0); }
                            } 

 else if  (dip1state == HIGH        //0D in HEX; C3
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)

 {if (buttonState1 == LOW) {
    tone(0, NOTE_C3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_CS3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_D3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_DS3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_E3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_F3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_FS3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_G3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_GS3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_A3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_AS3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_B3);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_C4);}
                                else {
                                  noTone(0); }
                            }            

 else if  (dip1state == LOW       // 0E in HEX; CS3
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)

 {if (buttonState1 == LOW) {
    tone(0, NOTE_CS3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_D3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_DS3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_E3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_F3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_FS3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_G3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_GS3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_A3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_AS3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_B3);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_C4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_CS4);}
                                else {
                                  noTone(0); }
                            }
else if  (dip1state == HIGH       // 0F in HEX; D3
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == HIGH
            && dip5state == LOW
            && dip6state == LOW)
{if (buttonState1 == LOW) {
    tone(0, NOTE_D3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_DS3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_E3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_F3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_FS3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_G3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_GS3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_A3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_AS3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_B3);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_C4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_CS4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_D4);}
                                else {
                                  noTone(0); }
                            }

else if  (dip1state == LOW        // 10 in HEX DS3
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
 { if (buttonState1 == LOW) {
    tone(0, NOTE_DS3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_E3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_F3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_FS3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_G3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_GS3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_A3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_AS3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_B3);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_C4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_CS4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_D4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_DS4);}
                                else {
                                  noTone(0); }
                            }
                            
 else if  (dip1state == HIGH         // 11 in HEX; E3
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)           
 { if (buttonState1 == LOW) {
    tone(0, NOTE_E3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_F3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_FS3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_G3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_GS3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_A3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_AS3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_B3);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_C4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_CS4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_D4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_DS4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_E4);}
                                else {
                                  noTone(0); }
                            }


else if  (dip1state == LOW           // 12 in HEX; F3
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)

{ if (buttonState1 == LOW) {
    tone(0, NOTE_F3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_FS3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_G3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_GS3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_A3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_AS3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_B3);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_C4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_CS4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_D4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_DS4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_E4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_F4);}
                                else {
                                  noTone(0); }
                            }

 else if  (dip1state == HIGH         // 13 in HEX; FS3
            && dip2state == HIGH
            && dip3state == LOW
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_FS3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_G3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_GS3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_A3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_AS3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_B3);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_C4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_CS4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_D4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_DS4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_E4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_F4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_FS4);}
                                else {
                                  noTone(0); }
                            }
            
 else if  (dip1state == LOW      // 14 in HEX; G3
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_G3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_GS3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_A3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_AS3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_B3);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_C4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_CS4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_D4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_DS4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_E4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_F4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_FS4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_G4);}
                                else {
                                  noTone(0); }
                            }
  else if  (dip1state == HIGH       // 15 in HEX; GS3
            && dip2state == LOW
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_GS3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_A3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_AS3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_B3);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_C4);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_CS4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_D4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_DS4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_E4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_F4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_FS4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_G4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_GS4);}
                                else {
                                  noTone(0); }
                            }
                     
else if  (dip1state == LOW        // 16 in HEX; A3
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_A3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_AS3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_B3);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_C4);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_CS4);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_D4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_DS4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_E4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_F4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_FS4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_G4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_GS4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_A4);}
                                else {
                                  noTone(0); }
                            }
                            
else if  (dip1state == HIGH     // 17 in HEX; AS3
            && dip2state == HIGH
            && dip3state == HIGH
            && dip4state == LOW
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_AS3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_B3);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_C4);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_CS4);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_D4);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_DS4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_E4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_F4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_FS4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_G4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_GS4);}
                          else if(buttonState12 == LOW) {
                            tone(0, NOTE_A4);}
                            else if(buttonState13 == LOW) {
                              tone(0, NOTE_AS4);}
                                else {
                                  noTone(0); }
                            }
  else if  (dip1state == LOW        // 18 in HEX; B3
            && dip2state == LOW
            && dip3state == LOW
            && dip4state == HIGH
            && dip5state == HIGH
            && dip6state == LOW)
{ if (buttonState1 == LOW) {
    tone(0, NOTE_B3);}
      else if (buttonState2 == LOW) {
      tone(0, NOTE_C4);}
        else if(buttonState3 == LOW) {
         tone(0, NOTE_CS4);}
         else if(buttonState4 == LOW) {
           tone(0, NOTE_D4);}
            else if(buttonState5 == LOW) {
              tone(0, NOTE_DS4);}
              else if(buttonState6 == LOW) {
                tone(0, NOTE_E4);}
                else if(buttonState7 == LOW) {
                  tone(0, NOTE_F4);}
                  else if(buttonState8 == LOW) {
                    tone(0, NOTE_FS4);}
                    else if(buttonState9 == LOW) {
                      tone(0, NOTE_G4);}
                      else if(buttonState10 == LOW) {
                        tone(0, NOTE_GS4);}
                        else if(buttonState11 == LOW) {
                          tone(0, NOTE_A4);}
...

This file has been truncated, please download it to see its full contents.

Schematics

Pushbutton Schematic
pushbutton%20schematic.vsd
Truth Table
Truth%20Table-%20Dip%20Switch.xlsx
Powerpoint Presentation of Pushbutton Piano
Pushbutton%20Piano(1).pptx

Comments

Similar projects you might like

Banana Piano

Project showcase by Baloo

  • 2,450 views
  • 2 comments
  • 5 respects

Electronic Piano Keyboard With Preset Songs

Project tutorial by Lindsay Fox

  • 79,789 views
  • 61 comments
  • 160 respects

Cool Baby Piano

Project showcase by Team cool guys

  • 886 views
  • 0 comments
  • 1 respect

Piano Stairs

Project tutorial by Bonnie Eisenman

  • 7,266 views
  • 2 comments
  • 31 respects

Arduino Tutorial : Mini Piano

Project tutorial by the lonely programmer

  • 6,284 views
  • 2 comments
  • 8 respects

PIANO

Project tutorial by يمنى السيد ندا

  • 2,657 views
  • 0 comments
  • 2 respects
Add projectSign up / Login