How to Make Your Own Piano Game

Introduction: How to Make Your Own Piano Game

About: My name is Simao and I love eletronics ,glass art,metal working,casting,paint ,draw...

It is a small game created by me.

You can play musics in this game ,pushing the buttons ,if you want a more light sound turn the potenciometer or a low frequency sound you just do the same.

Supplies:

  1. Arduino
  2. Breadboard
  3. jumpers
  4. 4x Push Buttons
  5. 10K potenciometer
  6. piezo Buzzer
  7. 220 resistor
  8. USB cable

Step 1: Wireing

Wire the components together like the schematic.

Step 2: The Code :

Put this code into the Arduino IDE and upload to the board.

#define A 2
#define B 3 #define C 4 #define D 5 #define TONE 9

void setup() { // put your setup code here, to run once: pinMode(A,INPUT); pinMode(B,INPUT); pinMode(C,INPUT); pinMode(D,INPUT);

pinMode(TONE,OUTPUT); pinMode(A0,INPUT); }

void loop() { // put your main code here, to run repeatedly: while (digitalRead(A)==HIGH){ tone(TONE,analogRead(A0)); } while (digitalRead(B)==HIGH){ tone(TONE,(analogRead(A0)+100)); } while (digitalRead(C)==HIGH){ tone(TONE,(analogRead(A0)+150)); } while (digitalRead(D)==HIGH){ tone(TONE,(analogRead(A0)+200)); } noTone(TONE); delay(100); }

Step 3: Downloads:

Games Contest

Participated in the
Games Contest

Be the First to Share

    Recommendations

    • Holiday Decorations Speed Challenge

      Holiday Decorations Speed Challenge
    • Plywood Challenge

      Plywood Challenge
    • Battery Powered Contest

      Battery Powered Contest

    Discussions