| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Lab6 - HJ

Page history last edited by Holly Jachowski 7 years, 5 months ago

Part B. Connect And Test Your Decoder

Describe the tone pattern you hear (ie, high or low?  how long? etc)

 

The pattern has three tones lasting about a second each (medium, low, then high) each followed by a pause that is also about second. The pattern continues to repeat.

 

Part C. Play Some Music!

Tell a member of the teaching team what your song is (or better yet, play it for us). If you don't know the name, just decipher some of the lyrics.

 

Mana mana – the Muppets

Absolutely Cuckoo – the Magnetic Fields

 

 

Does this code play all the songs in all the directories of the SD card? If not, which songs does it play? How does it keep from playing the text file?

 

Yes, the two songs on the card were played. Only .mp3 and .wav files are played (see code below from the Utilities sketch in Simple_MP3_V2 folder)

 

// only store mp3 or wav files in eeprom (for now). if you add other file

    // types, you should add their extensions here.

    if ((p.name()[i] == 'M' && p.name()[i+1] == 'P' && p.name()[i+2] == '3') ||

        (p.name()[i] == 'W' && p.name()[i+1] == 'A' && p.name()[i+2] == 'V')) {

         

      // store each character of the file name (including the terminate-array

      // character '\0' at position 12) into a byte in the eeprom.

      for (char i = 0; i < max_name_len; i++) {

        EEPROM.write(num_songs * max_name_len + i, p.name()[i]);

      }

      num_songs++;

    }

 

Change the 'Simple_MP3_V2' code to save the current volume setting in your EEPROM and fetch and set that value during initialization.  Note that the first max_num_songs*max_name_len (in this case, 520) bytes of the EEPROM are used to store file names, so don't overwrite those. 

 

EEPROM.write(max_num_songs * max_name_len + 1, mp3_vol);

 

myVS.setVolume(EEPROM.read(max_num_songs * max_name_len + 1));

or myVS.setVolume(mp3_vol);

 

Part D. Pause to Learn About Interrupts

Draw us a quick sketch of what your circuit looks like.

5 -> 10K resistor -> button -> ground

         digital pin 13 -> button

 

What are the pros and cons of using this method?

The bouncer method is cleaner in determining if the button has been pressed, because it only reads if the button state is high or low. This is as opposed to reading high state and associated noise that comes with pushing and releasing a regularly set up button. However in using the bouncer method, debounce time causes some delay, during which button pushes may not be registered. 

 

Comments (0)

You don't have permission to comment on this page.