-
E1c26033 3dfe 4809 b9ff 4f1c1c831658

invention

Virtual dad

by jdany

Published on November 28, 2015

Put the 'Wireless transmitter + Sound trigger + Arduino' circuit in dad's office. Put the 'Wireless receiver + mp3 player + speaker' circuit in kids' play room. Copy dad's message (e.g. 'Too loud!') to mp3 player. Modify the value of 'dadToleranceLevel' in the following Arduino sketch if needed:

//Pins
int xmitter = 5;
int soundsensor = A1;

//Misc
char buf[50];
int onCount = 0;

//Config
int dadToleranceLevel = 5;  //higher number == higher tolerance

void setup()
{
  Serial.begin(9600);
  pinMode(xmitter, OUTPUT);
}

void loop()
{
  int bSoundOn = digitalRead(soundsensor);

  if (bSoundOn)
  {
    onCount++;
    sprintf(buf, "sound on, cnt %d", onCount);
    if (onCount > dadToleranceLevel)
    {
      sprintf(buf, "sound still on, cnt %d", onCount);
      digitalWrite(xmitter, HIGH);
      onCount = 0;
    }
  }
  else
  {
    sprintf(buf, "sound off");
    analogWrite(xmitter, 0);
    onCount = 0;
  }

  Serial.println(buf);
  delay(1000);  
}
{code}


Duration: 1 hr

Related Projects

Sound Triggered Bubble Machine

Make a bubble machine triggered by sound! When you make a sound, a huge bubble is created! :D Watch video and learn how ...

Arduino Basics 4

Blinky's revenge: http://discuss.littlebits.cc/t/introduction-to-arduino-programming-4-blinkys-revenge/22240As in the other t...

Inchworm

INVENT A CREATURE THAT CRAWLS ACROSS THE CARPET like a hungry inchworm racing for an apple. See how quickly it can creep arou...