AUTHOR: Andreea-Cristina Bobe
GROUP : 1221EA
FACULTY: FILS
Besides implementing a simple piano, where you can play any song you want (in the limit of an octave because I only manage to connect 8 pushbuttons as keynotes), I came up with the idea of creating a special mode for those who do not know how to play the piano.
In the freestyle mode, you can play any song you want. The LED corresponding to the piano key you pressed will light up imediatelly.
In the teaching mode, the LED corresponding to the piano key on which you have to press will light up. If you pressed the correct piano key, the keyboard will move to the next note. Otherwise, all LEDS will change their color to red.
Using the active feedback way of learning (based on the repetition of all the notes learned until then) you will learn the desired song you always wanted.
For this project, I used:
In setup am setat intreruperile pe pinii pe care aveam butoane.
In loop, in modul guided al pianului am aprins ledul corespunzator notei care trebuie apasate.
In functiile ISR am preluat intreruperile de la butoane si am cantat nota corespunzatoare butonului folosind tone sau am schimbat modul / melodia.
Melodiile alese au fost scrise in intr-o singura octava.
Am definit notele muzicale folosite si de asemenea o variabila tempo pt a face pianul sa cante mai incet sau mai repede dupa preferinta.
Functia sizeof returneaza numarul de bytes, fiecare valoare int este compusa din 2 bytes (16 bits).
Variabila wholenote calculeza durata totala a unei note in ms.