AvE

AvE

Zen Blaster; a Most Annoying DIY Electronic Device (2015x55)


: 05, 2015

I build a little gadget to prank my lovely wife. WARNING! THIS DRIVES PEOPLE NUTS! DON'T DO IT TO SOMEONE WHO IS LIKELY TO PUNCH YOU IN THE FACE. Makes annoying beeps at random intervals. The random pitch and interval makes it very difficult to pin-point the source of the beeping. I might clean up the design and spin up a few circuit boards if anybody is interested in an easy build-along vid. Thanks for your help! http://www.Patreon.com/AvE Here's the code: /* Lil' BASTARD ZEN BLASTER WARNING! THIS DRIVES PEOPLE NUTS! DON'T DO IT TO ANYBODY WHO IS LIKELY TO PUNCH YOU IN THE FACE. Makes annoying beeps at random intervals. The random pitch and interval makes it very difficult to pin-point the source of the beeping. */ const int speaker = P1_7; // this sets the pin on the MSP430 that sends a beep to the speaker. int duration = 1000; // this is a variable that stores the value of length of the tone int frequency = 600; // this is a variable that stores the value of the frequency of the tone int counter = 0; // this is a variable that stores the value of how many times we've run thru the void loop int trigger = 1; // this is a variable that stores how many times we run thru the void loop prior to triggering a beep sequence int beeps = 2; // this is a variable that stores how many beeps in a sequence // the setup routine runs once when you press reset: void setup() { tone(P1_7, 2500, 800); delay (200); tone(P1_7, 500, 800); delay (200); tone(P1_7, 2500, 800); delay (200); // this runs through a few tones when you first start to let you know it's working. } // the loop routine runs over and over again forever: void loop() { counter = counter ++; // each time through the program, we add 1 to the value of counter if ( trigger == counter && beeps == 2) { // if the trigger value and the counter value are equal AND the beep value is 2 then do this: counter = 0; // resets the counter value to zero beeps = random (2, 5); /

  • : 2012
  • : 1051
  • : 0
  • YouTube