test code for hdc1080 humidity sensor

Dependencies:   hdc1080 mbed

Fork of Nucleo-F303K8-SSD1306_OLED by Joseph Ellsworth

Committer:
joeata2wh
Date:
Thu Jul 28 02:21:19 2016 +0000
Revision:
4:53d68b18bd43
Parent:
3:47148198f5f2
Child:
5:3c91772b714e
wip still not working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeata2wh 4:53d68b18bd43 1 /* Example of Reading TI HDC1080 sensor using STM F303K8 dev board
joeata2wh 4:53d68b18bd43 2
joeata2wh 4:53d68b18bd43 3 NOTE: As of 7/27/2016 with my custom board from seed studio I have
joeata2wh 4:53d68b18bd43 4 been unsucesful getting a response from the sensor. This may be due
joeata2wh 4:53d68b18bd43 5 to bad soldering so ordered a pre-made module to see if it works.
joeata2wh 2:dc3e84d595c3 6
joeata2wh 3:47148198f5f2 7 By Joseph Ellsworth CTO of A2WH
joeata2wh 3:47148198f5f2 8 Take a look at A2WH.com Producing Water from Air using Solar Energy
joeata2wh 4:53d68b18bd43 9 March-2016 License: https://developer.mbed.org/handbook/MIT-Licence
joeata2wh 3:47148198f5f2 10 Please contact us http://a2wh.com for help with custom design projects.
joeata2wh 3:47148198f5f2 11
joeata2wh 1:90d213185462 12 */
joeata2wh 0:fa185766e039 13
joeata2wh 0:fa185766e039 14 #include "mbed.h"
joeata2wh 4:53d68b18bd43 15 #include <stdint.h>
joeata2wh 2:dc3e84d595c3 16
joeata2wh 2:dc3e84d595c3 17 //Pin Defines for I2C Bus
joeata2wh 2:dc3e84d595c3 18 #define D_SDA PB_7 // specific for Nucleo-F303K8
joeata2wh 2:dc3e84d595c3 19 #define D_SCL PB_6 // specific for Nucleo-F303K8
joeata2wh 2:dc3e84d595c3 20 I2C i2c(D_SDA, D_SCL);
joeata2wh 4:53d68b18bd43 21 #include "hdc1080.h"
joeata2wh 4:53d68b18bd43 22
joeata2wh 2:dc3e84d595c3 23
joeata2wh 2:dc3e84d595c3 24 // Host PC Communication channels
joeata2wh 2:dc3e84d595c3 25 Serial pc(USBTX, USBRX); // tx, rx
joeata2wh 4:53d68b18bd43 26 char buff[100];
joeata2wh 2:dc3e84d595c3 27
joeata2wh 0:fa185766e039 28 DigitalOut myled(LED1);
joeata2wh 2:dc3e84d595c3 29
joeata2wh 2:dc3e84d595c3 30
joeata2wh 2:dc3e84d595c3 31 int main()
joeata2wh 2:dc3e84d595c3 32 {
joeata2wh 3:47148198f5f2 33 pc.baud(9600);
joeata2wh 0:fa185766e039 34 while(1) {
joeata2wh 4:53d68b18bd43 35 hdc_begin();
joeata2wh 4:53d68b18bd43 36 hdc_readManufactId();
joeata2wh 4:53d68b18bd43 37 hdc_readTemp();
joeata2wh 4:53d68b18bd43 38 hdc_readHumid();
joeata2wh 0:fa185766e039 39 }
joeata2wh 0:fa185766e039 40 }