# Hot line bling ardino help

**URL:** https://discourse.processing.org/t/hot-line-bling-ardino-help/11556
**Category:** Electronics (Arduino, etc.)
**Created:** [May 24, 2019, 3:48pm UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556 "2019-05-24T15:48:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![S.L.C.S](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@S.L.C.S](https://discourse.processing.org/u/S.L.C.S)
#### Post date: [May 24, 2019, 3:48pm UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/1 "2019-05-24T15:48:18Z")

</div>

I am supposed to get the below code or create a code that play hot line bling by Drake but i don’t understand how to input the notes for it.

```auto
 / ******************************************************************
 * SparkFun Inventor's Kit
 * Example sketch 11
 * 
 * BUZZER
 * 
 * This sketch uses the buzzer to play songs.
 * The Arduino's tone() command will play notes of a given frequency.
 * 
 * This sketch was written by SparkFun Electronics,
 * with lots of help from the Arduino community.
 * (This sketch was originally developed by D. Cuartielles for K3)
 * This code is completely free for any use.
 * Visit http://learn.sparkfun.com/products/2 for SIK information.
 * Visit http://www.arduino.cc to learn about the Arduino.
 * 
 * Version 2.0 6/2012 MDG
 * Version 2.1 9/2014 BCH
 ***************************************************************** /

const int buzzerPin = 9; // connect the buzzer to pin 9
const int songLength = 18; // sets the number of notes of the song

// Notes is an array of text characters corresponding to the notes
// in your song. A space represents a rest (no tone)

char notes[songLength] = {
  'c', 'd', 'f', 'd', 'a', ' ', 'a', 'g', ' ', 'c', 'd', 'f', 'd', 'g', ' ', 'g', 'f', ' '}; 

// beats[] is an array of values for each note. A "1" represents a quarter-note, 
// "2" a half-note, and "4" a quarter-note.
// Don't forget that the rests (spaces) need a length as well.

int beats[songLength] = {
  1, 1, 1, 1, 1, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 4, 2};

int tempo = 113; // The tempo is how fast to play the song (beats per second).

void setup() 
{
  pinMode(buzzerPin, OUTPUT); // sets the buzzer pin as an OUTPUT
}

void loop() 
{
  int i, duration; //

  for (i = 0; i < songLength; i++) // for loop is used to index through the arrays
  {
    duration = beats[i] * tempo; // length of note/rest in ms

    if (notes[i] == ' ') // is this a rest? 
      delay(duration); // then pause for a moment
    else // otherwise, play the note
    {
      tone(buzzerPin, frequency(notes[i]), duration);
      delay(duration); // wait for tone to finish
    }
    delay(tempo/10); // brief pause between notes
  }

  while(true){
  // We only want to play the song once, so we pause forever
  }
  // If you'd like your song to play over and over, remove the while(true)
  // statement above
}

int frequency(char note) 
{
  int i;
  const int numNotes = 8; // number of notes we're storing
  char names[numNotes] = { 
    'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int frequencies[numNotes] = {
    262, 294, 330, 349, 392, 440, 494, 523 };

  // Now we'll search through the letters in the array, and if
  // we find it, we'll return the frequency for that note.

  for (i = 0; i < numNotes; i++) // Step through the notes
  {
    if (names[i] == note) // Is this the one?
    {
      return(frequencies[i]); // Yes! Return the frequency and exit function.
    }
  }
  return(0); // We looked through everything and didn't find it,
  // but we still need to return a value, so return 0.
}

```

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [May 25, 2019, 1:16am UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/2 "2019-05-25T01:16:13Z")

</div>

- please tell us in how far that is a processing question.

- it is an arduino example code:

- 
  - did you load it up successful to a arduino?

- 
  - does it play a sound when you correct wired hardware?

- 
  - did you change the notes in the array “notes” to generate a different song?

---

<div class="post-metadata">

### Author: ![S.L.C.S](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@S.L.C.S](https://discourse.processing.org/u/S.L.C.S)
#### Post date: [May 25, 2019, 7:29am UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/3 "2019-05-25T07:29:05Z")

</div>

It loaded up successfully and it played a sound when i wired it correctly but i didn’t know how to change the notes is why i asked for help .

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [May 28, 2019, 5:40am UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/4 "2019-05-28T05:40:14Z")

</div>

> [@S.L.C.S](#):
>
> i didn’t know how to change the notes

Edit these two variables:

```auto
// Notes is an array of text characters corresponding to the notes
// in your song. A space represents a rest (no tone)

char notes[songLength] = {
  'c', 'd', 'f', 'd', 'a', ' ', 'a', 'g', ' ', 'c', 'd', 'f', 'd', 'g', ' ', 'g', 'f', ' '}; 

// beats[] is an array of values for each note. A "1" represents a quarter-note, 
// "2" a half-note, and "4" a quarter-note.
// Don't forget that the rests (spaces) need a length as well.

int beats[songLength] = {
  1, 1, 1, 1, 1, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 4, 2};

```

So for example:

 ![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/681438fe4974470379c734f9e3620824faeaf20e.jpeg)

then

```auto
char notes[songLength] = {
  'c', 'c', 'g', 'g', 'a', 'a', 'a', 'g', ' ', 'f', 'f', 'e', 'e', 'd', 'd', 'c', ' '}; 
int beats[songLength] = {
  1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2};

```

---

<div class="post-metadata">

### Author: ![S.L.C.S](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@S.L.C.S](https://discourse.processing.org/u/S.L.C.S)
#### Post date: [May 30, 2019, 3:15pm UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/5 "2019-05-30T15:15:45Z")

</div>

where could i get the notes for hotline bling?

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [May 30, 2019, 4:24pm UTC](https://discourse.processing.org/t/hot-line-bling-ardino-help/11556/6 "2019-05-30T16:24:13Z")

</div>

I don’t know. Maybe google searching the song name, plus “notes” or “sheet music” or “tabs” or “melody” or “for guitar” or “for piano”, or “how to play”…?
