sparkfun SEN-12642 Hook-Up Manual page 9

Sound detector
Table of Contents

Advertisement

/******************************************************************************
* sound_detector_demo.ino
* Sound detector sample sketch
* Byron Jacquot @ SparkFun Electronics
* February 19, 2014
* https://github.com/sparkfun/Sound_Detector
*
* This sketch demonstrates the use of the Sparkfun Sound Detector board.
*
* The Sound Detector is a small board that combines a microphone and some
* processing circuitry.
* binary indication of the presence of sound and an analog representation
* of it's amplitude.
*
* This sketch demonstrates two different modes of usage for the Sound
* Detector.
The gate output (a binary indication that is high when sound
* is present, and low when conditions are quiet) is used to fire a pin-change
* ISR, which lights an LED when the sound is present.
* (an analog voltage to rises to indicate the amplitude of the sound) is
* sampled in the loop(), and it prints an indication of the level to the
* serial terminal.
*
* For more details about the Sound Detector, please check the hookup guide.
*
* Connections:
* The Sound Detector is connected to the Adrduino as follows:
* (Sound Detector -> Arduino pin)
* GND → GND
* VCC → 5V
* Gate → Pin 2
* Envelope → A0
*
* Resources:
* Additional library requirements: none
*
* Development environment specifics:
* Using Arduino IDe 1.0.5
* Tested on Redboard, 3.3v/8MHz and 5v/16MHz ProMini hardware.
*
* This code is beerware; if you see me (or any other SparkFun employee) at the
* local, and you've found our code helpful, please buy us a round!
*
* Distributed as-is; no warranty is given.
******************************************************************************/
// Define hardware connections
#define PIN_GATE_IN 2
#define IRQ_GATE_IN
#define PIN_LED_OUT 13
#define PIN_ANALOG_IN A0
// soundISR()
// This function is installed as an interrupt service routine for the pin
// change interrupt.
It provides not only an audio output, but also a
0
When digital input 2 changes state, this routine
The envelope output

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SEN-12642 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents