Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GROVE_SOUND.h@0:fa75a7cf49b6, 2017-07-02 (annotated)
- Committer:
- ngomez
- Date:
- Sun Jul 02 11:33:55 2017 +0000
- Revision:
- 0:fa75a7cf49b6
Library for grove sound sensor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngomez | 0:fa75a7cf49b6 | 1 | /*************************************************** |
ngomez | 0:fa75a7cf49b6 | 2 | This is a library for grove sound sensor |
ngomez | 0:fa75a7cf49b6 | 3 | |
ngomez | 0:fa75a7cf49b6 | 4 | Written by Nerea Gómez. |
ngomez | 0:fa75a7cf49b6 | 5 | |
ngomez | 0:fa75a7cf49b6 | 6 | ****************************************************/ |
ngomez | 0:fa75a7cf49b6 | 7 | |
ngomez | 0:fa75a7cf49b6 | 8 | #ifndef MBED_GROVE_SOUND_H |
ngomez | 0:fa75a7cf49b6 | 9 | #define MBED_GROVE_SOUND_H |
ngomez | 0:fa75a7cf49b6 | 10 | #include "mbed.h" |
ngomez | 0:fa75a7cf49b6 | 11 | |
ngomez | 0:fa75a7cf49b6 | 12 | class GROVE_SOUND { |
ngomez | 0:fa75a7cf49b6 | 13 | public: |
ngomez | 0:fa75a7cf49b6 | 14 | |
ngomez | 0:fa75a7cf49b6 | 15 | GROVE_SOUND(PinName pin); |
ngomez | 0:fa75a7cf49b6 | 16 | float get_decibels(); |
ngomez | 0:fa75a7cf49b6 | 17 | |
ngomez | 0:fa75a7cf49b6 | 18 | private: |
ngomez | 0:fa75a7cf49b6 | 19 | |
ngomez | 0:fa75a7cf49b6 | 20 | AnalogIn _pin; |
ngomez | 0:fa75a7cf49b6 | 21 | float decibels; |
ngomez | 0:fa75a7cf49b6 | 22 | float values[1000]; |
ngomez | 0:fa75a7cf49b6 | 23 | float sum; |
ngomez | 0:fa75a7cf49b6 | 24 | float average; |
ngomez | 0:fa75a7cf49b6 | 25 | |
ngomez | 0:fa75a7cf49b6 | 26 | }; |
ngomez | 0:fa75a7cf49b6 | 27 | |
ngomez | 0:fa75a7cf49b6 | 28 | #endif |
ngomez | 0:fa75a7cf49b6 | 29 |