0

Music Maker shield with ultrasonic sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Music Maker shield with ultrasonic sensor

by dgeers on Wed May 19, 2021 1:35 pm

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

dgeers
 
Posts: 19
Joined: Mon Jan 24, 2011 5:22 pm

Re: Music Maker shield with ultrasonic sensor

by adafruit_support_bill on Wed May 19, 2021 1:43 pm

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

https://github.com/adafruit/Adafruit_VS1053_Library

adafruit_support_bill
 
Posts: 81565
Joined: Sat Feb 07, 2009 10:11 am

Re: Music Maker shield with ultrasonic sensor

by dgeers on Wed May 19, 2021 1:52 pm

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

Doug

dgeers
 
Posts: 19
Joined: Mon Jan 24, 2011 5:22 pm

Re: Music Maker shield with ultrasonic sensor

by dgeers on Wed May 19, 2021 2:42 pm

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

dgeers
 
Posts: 19
Joined: Mon Jan 24, 2011 5:22 pm

Please be positive and constructive with your questions and comments.