ClosedCube SHT30A-EASY breakout module code example for SHT30-ARP-B Analog Humidity & Temperature Sensor

Dependencies:   SHT3XA mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  SHT30-ARP-B Analog Humidity & Temperature Sensor Example Code 
00003  ClosedCube SHT30A-EASY breakout module
00004  
00005  License: This example code is in the public domain.
00006  Date: 14-Sep-2015
00007   
00008  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00009  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00010  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00011  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00012  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00013  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
00014  */
00015 
00016 #include "mbed.h"
00017 #include "SHT3XA.h"
00018 
00019 /*
00020     Hardware connections:
00021         VDD to 3.3V
00022         RH to A0
00023         T to A1
00024         GND to GND   
00025 */
00026 SHT3XA sht30a(A0,A1);
00027 
00028 Serial pc(USBTX, USBRX);
00029  
00030 int main() {  
00031     pc.baud(115200);
00032     pc.printf("ClosedCube SHT30A-EASY example"); 
00033 
00034     while( true ) {
00035         pc.printf("T: %3.2fC RH: %3.2f%%\n", sht30a.readTempC(), sht30a.readRH());        
00036         wait(0.3f);
00037     }
00038     
00039 }