
Weather control switch for connected day. NXP LPC 1768 module. Ethernet connectivity.
Dependencies: EthernetInterface mbed-rtos mbed nanoservice_client_1_12
Fork of Trenton_Switch_LPC1768_WIFLY by
MAX9814/MAX9814.h@25:cb16c5248769, 2014-12-03 (annotated)
- Committer:
- andcor02
- Date:
- Wed Dec 03 09:03:29 2014 +0000
- Revision:
- 25:cb16c5248769
ETH CES
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andcor02 | 25:cb16c5248769 | 1 | /* |
andcor02 | 25:cb16c5248769 | 2 | MAX9814.h - MAX9814 sensor library |
andcor02 | 25:cb16c5248769 | 3 | Developed by Andrea Corrado |
andcor02 | 25:cb16c5248769 | 4 | */ |
andcor02 | 25:cb16c5248769 | 5 | |
andcor02 | 25:cb16c5248769 | 6 | /* |
andcor02 | 25:cb16c5248769 | 7 | Example 'main.cpp' |
andcor02 | 25:cb16c5248769 | 8 | |
andcor02 | 25:cb16c5248769 | 9 | #include "mbed.h" |
andcor02 | 25:cb16c5248769 | 10 | #include "MAX9814.h" |
andcor02 | 25:cb16c5248769 | 11 | Serial pc (USBTX, USBRX); |
andcor02 | 25:cb16c5248769 | 12 | |
andcor02 | 25:cb16c5248769 | 13 | |
andcor02 | 25:cb16c5248769 | 14 | MAX9814 mic(p20); |
andcor02 | 25:cb16c5248769 | 15 | |
andcor02 | 25:cb16c5248769 | 16 | int main() |
andcor02 | 25:cb16c5248769 | 17 | { |
andcor02 | 25:cb16c5248769 | 18 | while (1) { |
andcor02 | 25:cb16c5248769 | 19 | mic.volume_indicator(); |
andcor02 | 25:cb16c5248769 | 20 | pc.printf("\n\r Level is %f", mic.sound_level()); |
andcor02 | 25:cb16c5248769 | 21 | } |
andcor02 | 25:cb16c5248769 | 22 | } |
andcor02 | 25:cb16c5248769 | 23 | |
andcor02 | 25:cb16c5248769 | 24 | */ |
andcor02 | 25:cb16c5248769 | 25 | |
andcor02 | 25:cb16c5248769 | 26 | #ifndef MBED_MIC_H |
andcor02 | 25:cb16c5248769 | 27 | #define MBED_MIC_H |
andcor02 | 25:cb16c5248769 | 28 | |
andcor02 | 25:cb16c5248769 | 29 | #include "mbed.h" |
andcor02 | 25:cb16c5248769 | 30 | |
andcor02 | 25:cb16c5248769 | 31 | class MAX9814 { |
andcor02 | 25:cb16c5248769 | 32 | |
andcor02 | 25:cb16c5248769 | 33 | public: |
andcor02 | 25:cb16c5248769 | 34 | |
andcor02 | 25:cb16c5248769 | 35 | MAX9814(PinName pin); //Analogue in |
andcor02 | 25:cb16c5248769 | 36 | float sound_level(); |
andcor02 | 25:cb16c5248769 | 37 | |
andcor02 | 25:cb16c5248769 | 38 | protected: |
andcor02 | 25:cb16c5248769 | 39 | AnalogIn _pin; |
andcor02 | 25:cb16c5248769 | 40 | float _value; |
andcor02 | 25:cb16c5248769 | 41 | float _sample; |
andcor02 | 25:cb16c5248769 | 42 | Timer _t,_t1; |
andcor02 | 25:cb16c5248769 | 43 | }; |
andcor02 | 25:cb16c5248769 | 44 | |
andcor02 | 25:cb16c5248769 | 45 | #endif |