LapPiano

Students Projects

Electronics

Arduino

LapPiano

LapPiano

Created By

  • Reyansh-03

    Reyansh

    Lorem ipsum dolor sit amet, consectetur adipisi cing elit, sed do eiusmod tempor incididunt ut abore et dolore magnaMy project is about irrigation system. It water the plant whenever the soil is dry and if we want more water we can do it by sitting in chair because the Bluetooth in the project connects with the system with the help of the app. After connecting you can check the status of the soil and pump the water and turn it off again

About This Project

This project is about lapPiano. We control it using a laptop and arduino connected to it. But the problem is in Serial monitor we have to press enter every time whenever we type a note. I have solved that problem by using PuTTY. You can download PuTTY from putty.org. The notes are printed in the Serial port. To open putty first open putty then select Serial then write the COM port of arduino then click on open.

Components Required

  • Arduino UNO
  • Speaker : 0.25W, 8 ohms

Schematics

In this image all the components with the connections are given

LapPiano

Code Of Project

#include "pitches.h"

int C[] = {NOTE_C5};
int CS[] = {NOTE_CS5};
int D[] = {NOTE_D5};
int DS[] = {NOTE_DS5};
int E[] = {NOTE_E5};
int F[] = {NOTE_F5};
int FS[] = {NOTE_FS5};
int G[] = {NOTE_G5};
int GS[] = {NOTE_GS5};
int A[] = {NOTE_A5};
int AS[] = {NOTE_AS5};
int B[] = {NOTE_B5};
int CC[] = {NOTE_C6};
int duration(500);

void setup() {
  pinMode(11, OUTPUT); //Digital Pin 11 is where you connect your Buzzer
  Serial.begin(9600);
  Serial.println("Welcome to the Virtual Keyboard!");
  Serial.println("Notes: A-S-D-F-G-H-J");
  Serial.println("#: Q-W-E-R-T-Y-U");
}

void loop() {
  if (Serial.available()) {
    char ch = Serial.read();
    if (ch == 'a') {
    for (int Note = 0; Note < 1; Note++) {
      tone(11, C[Note], duration);
    }
    }
    if (ch == 'q') {
    for (int Note = 0; Note < 1; Note++) {
      tone(11, CS[Note], duration);
    }
    }
    if (ch == 's') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, D[Note], duration);
    }
    }
    if (ch == 'w') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, DS[Note], duration);
    }
    }
    if (ch == 'd') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, E[Note], duration);
    }
    }
    if (ch == 'f') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, F[Note], duration);
    }
    }
    if (ch == 'r') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, FS[Note], duration);
    }
    }
    if (ch == 'g') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, G[Note], duration);
    }
    }
    if (ch == 't') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, GS[Note], duration);
    }
    }
    if (ch == 'h') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, A[Note], duration);
    }
    }
    if (ch == 'y') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, AS[Note], duration);
    }
    }
    if (ch == 'j') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, B[Note], duration);
    }
    }
    if (ch == 'u') {
    for (int Note = 0; Note < 1; Note++) {
       tone(11, CC[Note], duration);
    }
    }
  }
}
Share