CN0396 (4-Wire Electrochemical Dual Toxic Gas Sensing System) Hello world
For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
main.cpp@1:1389e937dc4a, 2016-11-08 (annotated)
- Committer:
- adisuciu
- Date:
- Tue Nov 08 09:51:47 2016 +0000
- Revision:
- 1:1389e937dc4a
- Parent:
- 0:bcdb26c2bf0d
Fix for mbed online compiler
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adisuciu | 0:bcdb26c2bf0d | 1 | /** |
adisuciu | 0:bcdb26c2bf0d | 2 | * @file main.cpp |
adisuciu | 0:bcdb26c2bf0d | 3 | * @brief Main file for the CN0357-example project |
adisuciu | 0:bcdb26c2bf0d | 4 | * @author Analog Devices Inc. |
adisuciu | 0:bcdb26c2bf0d | 5 | * |
adisuciu | 0:bcdb26c2bf0d | 6 | * For support please go to: |
adisuciu | 0:bcdb26c2bf0d | 7 | * Github: https://github.com/analogdevicesinc/mbed-adi |
adisuciu | 0:bcdb26c2bf0d | 8 | * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers |
adisuciu | 0:bcdb26c2bf0d | 9 | * Product: www.analog.com/EVAL-CN0357-ARDZ |
adisuciu | 0:bcdb26c2bf0d | 10 | * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all |
adisuciu | 0:bcdb26c2bf0d | 11 | |
adisuciu | 0:bcdb26c2bf0d | 12 | ******************************************************************************** |
adisuciu | 0:bcdb26c2bf0d | 13 | * Copyright 2016(c) Analog Devices, Inc. |
adisuciu | 0:bcdb26c2bf0d | 14 | * |
adisuciu | 0:bcdb26c2bf0d | 15 | * All rights reserved. |
adisuciu | 0:bcdb26c2bf0d | 16 | * |
adisuciu | 0:bcdb26c2bf0d | 17 | * Redistribution and use in source and binary forms, with or without |
adisuciu | 0:bcdb26c2bf0d | 18 | * modification, are permitted provided that the following conditions are met: |
adisuciu | 0:bcdb26c2bf0d | 19 | * - Redistributions of source code must retain the above copyright |
adisuciu | 0:bcdb26c2bf0d | 20 | * notice, this list of conditions and the following disclaimer. |
adisuciu | 0:bcdb26c2bf0d | 21 | * - Redistributions in binary form must reproduce the above copyright |
adisuciu | 0:bcdb26c2bf0d | 22 | * notice, this list of conditions and the following disclaimer in |
adisuciu | 0:bcdb26c2bf0d | 23 | * the documentation and/or other materials provided with the |
adisuciu | 0:bcdb26c2bf0d | 24 | * distribution. |
adisuciu | 0:bcdb26c2bf0d | 25 | * - Neither the name of Analog Devices, Inc. nor the names of its |
adisuciu | 0:bcdb26c2bf0d | 26 | * contributors may be used to endorse or promote products derived |
adisuciu | 0:bcdb26c2bf0d | 27 | * from this software without specific prior written permission. |
adisuciu | 0:bcdb26c2bf0d | 28 | * - The use of this software may or may not infringe the patent rights |
adisuciu | 0:bcdb26c2bf0d | 29 | * of one or more patent holders. This license does not release you |
adisuciu | 0:bcdb26c2bf0d | 30 | * from the requirement that you obtain separate licenses from these |
adisuciu | 0:bcdb26c2bf0d | 31 | * patent holders to use this software. |
adisuciu | 0:bcdb26c2bf0d | 32 | * - Use of the software either in source or binary form, must be run |
adisuciu | 0:bcdb26c2bf0d | 33 | * on or directly connected to an Analog Devices Inc. component. |
adisuciu | 0:bcdb26c2bf0d | 34 | * |
adisuciu | 0:bcdb26c2bf0d | 35 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
adisuciu | 0:bcdb26c2bf0d | 36 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
adisuciu | 0:bcdb26c2bf0d | 37 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
adisuciu | 0:bcdb26c2bf0d | 38 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
adisuciu | 0:bcdb26c2bf0d | 39 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
adisuciu | 0:bcdb26c2bf0d | 40 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
adisuciu | 0:bcdb26c2bf0d | 41 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
adisuciu | 0:bcdb26c2bf0d | 42 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
adisuciu | 0:bcdb26c2bf0d | 43 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
adisuciu | 0:bcdb26c2bf0d | 44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
adisuciu | 0:bcdb26c2bf0d | 45 | * |
adisuciu | 0:bcdb26c2bf0d | 46 | ********************************************************************************/ |
adisuciu | 0:bcdb26c2bf0d | 47 | #include "mbed.h" |
adisuciu | 0:bcdb26c2bf0d | 48 | #include "CN0396.h" |
adisuciu | 0:bcdb26c2bf0d | 49 | |
adisuciu | 0:bcdb26c2bf0d | 50 | Serial pc(SERIAL_TX, SERIAL_RX); |
adisuciu | 0:bcdb26c2bf0d | 51 | |
adisuciu | 0:bcdb26c2bf0d | 52 | int main() |
adisuciu | 0:bcdb26c2bf0d | 53 | { |
adisuciu | 0:bcdb26c2bf0d | 54 | pc.baud(115200); |
adisuciu | 0:bcdb26c2bf0d | 55 | pc.printf("Initializing \r\n"); |
adisuciu | 0:bcdb26c2bf0d | 56 | CN0396 cn0396(D10, D6, D4); |
adisuciu | 0:bcdb26c2bf0d | 57 | cn0396.init(); |
adisuciu | 0:bcdb26c2bf0d | 58 | wait_ms(500); |
adisuciu | 0:bcdb26c2bf0d | 59 | |
adisuciu | 0:bcdb26c2bf0d | 60 | while(1) { |
adisuciu | 0:bcdb26c2bf0d | 61 | cn0396.read(); |
adisuciu | 0:bcdb26c2bf0d | 62 | wait_ms(1000); |
adisuciu | 0:bcdb26c2bf0d | 63 | } |
adisuciu | 0:bcdb26c2bf0d | 64 | return 0; |
adisuciu | 0:bcdb26c2bf0d | 65 | } |