Can I2C Arduino slave interrupt Arduino master to signal event?

Hi,
I have an MP3 player set up on one Arduino (Nano V3, slave) connected to another Arduino (Nano V3, master) which is getting IR codes from a remote. I had to use two arduinos because the IR wouldn't work with the MP3 (too busy feeding the buffer).
The master tells the slave which song to play, but I'd like the slave to be able to signal the master when the song has completed playing. I suppose the slave only responds to the master when requested, and I'd rather not poll the slave every quarter second. I'm a beginner, so is it possible to have the slave interrupt the master? I was thinking pin 2 or 3 and attach interrupt, but I have no idea how to wire that. Assistance is appreciated.
Thanks.

You can certainly use an interrupt.

Not sure if this is the best way to do it, however I have a similar set-up. Wire one of the slaves available digital pins to the master's interrupt pin (2 or 3). If using pin 2 (interrupt 0), set-up your interrupt for the Master as so...

void setup()
{
   attachInterrupt(0, myinterrupt, FALLING);
}

On a falling edge this will call the function 'myinterrupt' where you could notify the program of the song finishing.

For generating the interrupt from the slave, you can simply pulse a pin high and then low as so...

digitalWrite(7, HIGH);
delay(10);
digitalWrite(7, LOW);

LarryW:
I suppose the slave only responds to the master when requested, and I'd rather not poll the slave every quarter second.

If by this, you mean that you would prefer not to have the slave required to respond four times a second, this is fair enough, as it may well be quite occupied playing the MP3.

On the other hand, "polling" is precisely how the "master" will be anticipating communication from the "slave", and not four times a second, but just as likely, four thousand times a second which is - if you have programmed it correctly, the sort of speed at which it will be executing the main "loop" process as it polls for events.

I must presume you are using the serial interface between master and slave, but similar considerations hold for alternatives such as I2C. The serial interface is relatively straightforward. Polling for serial input is - as you would have already determined - performed by the Serial.available() function which - lo and behold! - is already implemented for you by the serial library using interrupts without you having to worry your little head as to how!

And the mantra I so often find it necessary to repeat - It is one of the most common misunderstandings for "newbies" to think that an interrupt is a means to alter the flow of the main program. In fact, the very opposite is the case, an interrupt is designed such that a brief but important operation which must and can be processed immediately will be performed without affecting the flow of the primary program in any way.

This is not to be confused with the consequence that something that the ISR does may later be consequential to the main program as it continues to process its various tasks. This is equally true of a multi-tasking OS where an interrupt may result in task-switching but nevertheless on resumption, the immediate course of each task is as a matter of definition, unaffected.

POOF !I think my brain just exploddd...