Music Maker shield with ultrasonic sensor

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dgeers
 
Posts: 41
Joined: Mon Jan 24, 2011 5:22 pm

Music Maker shield with ultrasonic sensor

Post by dgeers »

Hi again. I'm helping a student finish their project using an ultrasonic sensor to control a Music Maker shield with Arduino.

The audio content is a 30-minute show as a gallery installation. The audio pauses and resumes based on viewer proximity.

Is there an easy way to query the Music Maker to see whether the sound file has finished? We want it to re-cue from the beginning after it has played the entire 30 minutes.

Since it pauses and resumes repeatedly based on viewer/audience movement/location, I can't simply run a timer. I realize I could start and stop one as all of this happens, but if there would be a simple command to ask the Music Maker whether it has completed playing a sound, that would be awesome.

Thanks!

Doug

User avatar
adafruit_support_bill
 
Posts: 88089
Joined: Sat Feb 07, 2009 10:11 am

Re: Music Maker shield with ultrasonic sensor

Post by adafruit_support_bill »

The "stopped" function in the library will return 'true' if the track has finished playing.

https://github.com/adafruit/Adafruit_VS1053_Library

User avatar
dgeers
 
Posts: 41
Joined: Mon Jan 24, 2011 5:22 pm

Re: Music Maker shield with ultrasonic sensor

Post by dgeers »

This is awesome! Thank you, Adafruit people!!!

Doug

User avatar
dgeers
 
Posts: 41
Joined: Mon Jan 24, 2011 5:22 pm

Re: Music Maker shield with ultrasonic sensor

Post by dgeers »

Hi again. I'm continuing to help my student. Now we have found that if we use our ultrasonic sensor on pins 11 and 12 in a simple test bit of code, the sensor works. However if we include the three libraries advised for the MusicMaker
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
Then we get zero as ultrasonic reading always.

I see that pins 11 and 12 may be used for MOSI and MISO:
//#define MISO 12 // Input data, from VS1053/SD card
//#define MOSI 11 // Output data, to VS1053/SD card

But we have commented those out. We don't have many other options to drive the sensor though. I had thought to move to pins 2 and 5, but it turns out that the student has already soldered to pins 11 and 12 and if there is another solution that would be ideal.

Thanks,

Doug

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”