Arduino Project 12 | Arduino Plays SaReGaMa

preview_player
Показать описание
@TechnoVillage2024
In this video we will show how to play musical notes using Arduino Uno, first step towards music, we will play Sa Re Ga Ma first. The simple note frequencies starts from 240 hertz to 480 hertz. The list of frequencies is given here in this description. The most important command is used here is tone() Command. It takes 3 important parameters, one is Pin number, second is the frequency in hertz and third one is the duration of play in milliseconds. It produces a square of the given frequency in square wave. Pulse width modulation having a duty cycle of 50% is generated. The tone is played till notone() command is executed.
In the code I have taken the array of all the frequencies and inside setup code I looped through the frequencies one by one, so this frequency as played and using a delay command and finally notone() command stops this tone. For this project we need only one breadboard, 8 ohms speaker and one hundred micro farad capacitor and Arduino UNO board.

More about tone() command

More about managing melody

Code for this project
____________________

/*
Sa Re Ga Ma
*/

// notes in the melody:
int melody[] = {
240, 270, 300, 320, 360, 400, 450, 480, 480, 450, 400, 360, 320, 300, 270, 240
};

void setup() {
// iterate over the notes of the melody:
for (int thisNote = 0; thisNote 'is less than' 16; thisNote++) {

tone(8, melody[thisNote]);

delay(1000);
// stop the tone playing:
noTone(8);
}
}

void loop() {
// no need to repeat the melody.
}

__________________________________________________________________________
Tone Frequencies
Sa - 240
Re - 270
Ga - 300
Ma - 320
Pa - 360
Dha - 400
Ni - 450

#arduino #arduinoMusic #arduinoSong #howToArduino #ArduinoPlaysMusic
@ArduinoSings
Рекомендации по теме
Комментарии
Автор

Many thanks.. too illustrious . Very educational

managovindamishra
visit shbcf.ru