Parkay commercial


ok nervous post have long standing joke daughter based on old parkay commercial container opens , says "butter" ... twice says "parkay".. want rig desk drawer @ work this. when comes in open drawer , "butter" ... close drawer , reopen , repeat "butter" on third time "parkay"... seems simple enough use sound board , have triggered reed switch or optic switch how sequential playback... ?

keyman450

you need add counter in sketch counts number of opens.

if there time between openings of drawer counter resets

if number 3 reset

play soundfile belongs count

in pseudo code
code: [select]

char sf[4][20] = {"dummy", "butter.mp3", "butter.mp3", "parkay.mp3" };

void loop()
{
  val = digitalread(switch);
  if (val == high)
  {
    count++;
    lastcount = millis();
    playsoundfile(sf[count]);
  }
  if (millis() - lastcount > (10*1000ul) ) count = 0;  // reset after 10 seconds
}



 


Arduino Forum > Using Arduino > Audio > Parkay commercial


arduino

Comments