Tutorial.EsploraSoundSensor History

Hide minor edits - Show changes to output

December 24, 2012, at 04:15 AM by Tom Igoe -
Changed lines 26-27 from:
The [[Reference/readMicrophone | Esplora.readMicrophone]]() function gets the value from the microphone. It will give you a value between 0 and 1023.
to:
The [[Reference/EsploraReadMicrophone | Esplora.readMicrophone]]() function gets the value from the microphone. It will give you a value between 0 and 1023.
Changed line 47 from:
* [[Reference/readMicrophone | Esplora.readMicrophone]]()
to:
* [[Reference/EsploraReadMicrophone | Esplora.readMicrophone]]()
December 24, 2012, at 04:14 AM by Tom Igoe -
Changed lines 26-27 from:
The [[/Reference/readMicrophone | Esplora.readMicrophone]]() function gets the value from the microphone. It will give you a value between 0 and 1023.
to:
The [[Reference/readMicrophone | Esplora.readMicrophone]]() function gets the value from the microphone. It will give you a value between 0 and 1023.
Changed line 47 from:
* [[/Reference/readMicrophone | Esplora.readMicrophone]]()
to:
* [[Reference/readMicrophone | Esplora.readMicrophone]]()
December 24, 2012, at 04:11 AM by Tom Igoe -
Added lines 1-47:
''Examples > Esplora''

!!!Esplora Microphone (Sound Sensor)

This sketch shows you how to read the microphone sensor. The microphone will range from 0 (total silence) to 1023 (really loud). It uses the sound level to set a brightness level for the green LED. When you're using the sensor's reading (for example, to set the brightness of the LED), you map the sensor's reading to a range between the minimum and the maximum.

(:div class=BOM :)
!!!Hardware Required
* Arduino Esplora
(:divend:)

!!!Circuit
Only your Arduino Esplora is needed for this example. Connect the Esplora to your computer with a USB cable and open the Arduino's Serial Monitor.


%height=350px%[[Attach:Esplora_SoundSensor.png | Attach:Esplora_SoundSensor.png]]
[- Microphone to send data to your computer from the Esplora-]

(:divend:)


!!!Code

To send data to your computer, you need to open a serial connection. use [[/Serial/Begin | Serial.begin]]() to open a serial port at 9600 baud on the Esplora.

The [[/Reference/readMicrophone | Esplora.readMicrophone]]() function gets the value from the microphone. It will give you a value between 0 and 1023.

To send the values to the Serial Monitor, you call [[Serial/print | Serial.print]](). When the Esplora is connected, and the Serial Monitor is open, you should start to see values reported like this:\\

[@
sound level: 172 Green brightness: 42
sound level: 74 Green brightness: 18
sound level: 153 Green brightness: 38
sound level: 67 Green brightness: 16
sound level: 93 Green brightness: 23
sound level: 110 Green brightness: 27

@]


(:div class=code :)
(:source https://raw.github.com/arduino/Arduino/master/libraries/Esplora/examples/Beginners/EsploraSoundSensor/EsploraSoundSensor.ino lang=arduino tabwidth=4:)
(:divend:)


!!!See Also:
* [[/Reference/readMicrophone | Esplora.readMicrophone]]()

Share