roshan-baig
Published © GPL3+

Arduino Piano Library Release!

This is a library which allows you to play some basic notes.

BeginnerShowcase (no instructions)1,096
Arduino Piano Library Release!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Any Arduino Will Work
×1
Speaker, Piezo
Speaker, Piezo
×1
Buzzer
Buzzer
×1
Buzzer, Piezo
Buzzer, Piezo
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The Circuit

Code

The Example Code

C/C++
#include <Piano.h>
/*
 * This is a Piano Arduino Library Developed By Roshan Baig
 * This is an example which plays a note when a button is pushed
 * Here are the current note commands
 * speaker.play_Bass_c();
 * speaker.play_Bass_c_sharp();
 * speaker.play_Bass_d();
 * speaker.play_Bass_d_sharp();
 * speaker.play_Bass_e();
 * speaker.play_Bass_f();
 * speaker.play_Bass_f_sharp();
 * speaker.play_Bass_g();
 * speaker.play_Bass_g_sharp();
 * speaker.play_Bass_a();
 * speaker.play_Bass_a_sharp();
 * speaker.play_Bass_b();
 * speaker.play_Middle_c();
 * speaker.play_Treble_d();
 * speaker.play_Treble_e();
 * speaker.play_Treble_f();
 * speaker.play_Treble_g();
 * speaker.play_Treble_a();
 * speaker.play_Treble_b();
 * speaker.play_Upper_C();
 * speaker.play_Treble_a_sharp();
 * speaker.noPlay();
 */
const int speakerPin = 13;
Piano speaker(speakerPin);
void setup() {
  pinMode(2, INPUT);
  speaker.init();
  Serial.begin(9600);
}

void loop() {
  if(digitalRead(2) == HIGH)
  {
    speaker.play_Upper_C();
  } else
  {
    speaker.noPlay();
  }
}

Credits

roshan-baig

roshan-baig

5 projects • 7 followers

Comments