Baby Monitoring System
Loading...
Searching...
No Matches
Songs.h File Reference

Defines 3 songs by frequency and note duration and provides functions to play them on a buzzer connected to an Arduino Nano ESP32. More...

#include <Arduino.h>

Go to the source code of this file.

Functions

void playNotes (int buzzerPin, int notes[], int durations[], int length)
 Plays each note for a given song.
 
void playSong (int buzzerPin, int songNum)
 Plays the song associated with the given song number using the provided buzzer pin.
 

Variables

int song1Notes []
 Frequency values for notes in "Twinkle Twinkle Little Star".
 
int song1NoteDurations []
 Durations for notes in "Twinkle Twinkle Little Star".
 
int song2Notes []
 Frequency values for notes in "Mary Had a Little Lamb".
 
int song2NoteDurations []
 Durations for notes in "Mary Had a Little Lamb".
 
int song3Notes []
 Frequency values for notes in "The Wheels on the Bus".
 
int song3NoteDurations []
 Durations for notes in "The Wheels on the Bus".
 

Detailed Description

Defines 3 songs by frequency and note duration and provides functions to play them on a buzzer connected to an Arduino Nano ESP32.

Authors
Caitlyn Rawlings, Hao Tian
Date
8/12/24

Function Documentation

◆ playNotes()

void playNotes ( int buzzerPin,
int notes[],
int durations[],
int length )

Plays each note for a given song.

Parameters
buzzerPinThe pin connected to the buzzer.
notesArray of note frequencies.
durationsArray of note durations.
lengthNumber of notes in the song.

◆ playSong()

void playSong ( int buzzerPin,
int songNum )

Plays the song associated with the given song number using the provided buzzer pin.

Parameters
buzzerPinThe pin connected to the buzzer.
songNumThe number of the song to play (1, 2, or 3).

Variable Documentation

◆ song1NoteDurations

int song1NoteDurations[]
Initial value:
= {
4, 4, 4, 4, 4, 4, 2,
4, 4, 4, 4, 4, 4, 2,
4, 4, 4, 4, 4, 4, 2,
4, 4, 4, 4, 4, 4, 2,
4, 4, 4, 4, 4, 4, 2,
4, 4, 4, 4, 4, 4, 2
}

Durations for notes in "Twinkle Twinkle Little Star".

◆ song1Notes

int song1Notes[]
Initial value:
= {
261, 261, 392, 392, 440, 440, 392,
349, 349, 329, 329, 294, 294, 261,
392, 392, 349, 349, 329, 329, 294,
392, 392, 349, 349, 329, 329, 294,
261, 261, 392, 392, 440, 440, 392,
349, 349, 329, 329, 294, 294, 261
}

Frequency values for notes in "Twinkle Twinkle Little Star".

◆ song2NoteDurations

int song2NoteDurations[]
Initial value:
= {
4, 4, 4, 4, 4, 4, 2,
4, 4, 2, 4, 4, 2,
4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 1
}

Durations for notes in "Mary Had a Little Lamb".

◆ song2Notes

int song2Notes[]
Initial value:
= {
330, 294, 262, 294, 330, 330, 330,
294, 294, 294, 330, 392, 392,
330, 294, 262, 294, 330, 330, 330,
330, 294, 294, 330, 294, 262
}

Frequency values for notes in "Mary Had a Little Lamb".

◆ song3NoteDurations

int song3NoteDurations[]
Initial value:
= {
4, 4, 8, 8, 4, 4, 4, 4, 4, 4,
4, 4, 2, 4, 4, 4,
4, 4, 8, 8, 4, 4, 4, 4, 2, 4,
2, 2, 1
}

Durations for notes in "The Wheels on the Bus".

◆ song3Notes

int song3Notes[]
Initial value:
= {
262, 349, 349, 349, 349, 440, 262, 440, 349, 0,
392, 392, 392, 330, 294, 262,
262, 349, 349, 349, 349, 440, 262, 440, 349, 0,
392, 262, 349
}

Frequency values for notes in "The Wheels on the Bus".