Simple temperature and humidity program example for Hexiwear featuring UART
Fork of HTU21D by
This project demonstrates the use of the HTU21D temperature and humidity sensor embedded in Hexiwear
Open a Hyperterminal tool on your computer and connect it to the "mbed Serial port (COMxx)" with Baud rate "9600bps"
Compile the project and copy the binary "Hexi_Humid_Temp_Example_HEXIWEAR.bin" in the DAP-LINK drive from your computer file explorer Press the K64F-RESET button on the docking station to start the program on your board
Every 500ms the value of the Temperature and Humidity will be displayed in the Hyperterminal window and the LED will blink Green
Diff: HTU21D/HTU21D.cpp
- Revision:
- 1:d7568a103ef5
- Parent:
- 0:db86ad1b4459
- Child:
- 2:4fd07be6bad8
--- a/HTU21D/HTU21D.cpp Fri Mar 28 14:55:03 2014 +0000 +++ b/HTU21D/HTU21D.cpp Sun Oct 19 18:24:53 2014 +0000 @@ -45,11 +45,11 @@ tx[0] = TRIGGER_TEMP_MEASURE; // Triggers a temperature measure by feeding correct opcode. i2c_->write((HTU21D_I2C_ADDRESS << 1) & 0xFE, tx, 1); - wait_ms(1); + wait_ms(50); // Reads triggered measure i2c_->read((HTU21D_I2C_ADDRESS << 1) | 0x01, rx, 2); - wait_ms(1); + wait_ms(50); // Algorithm from datasheet to compute temperature. unsigned int rawTemperature = ((unsigned int) rx[0] << 8) | (unsigned int) rx[1];