A demo program for STTS751 (I2C temperature sensor library)

Dependencies:   STTS751 mbed

main.cpp

Committer:
takuo
Date:
2014-01-19
Revision:
2:9850512c9113
Parent:
1:8fb0961c0dc8
Child:
3:a2d2563ae3ef

File content as of revision 2:9850512c9113:

/** A demo program for STTS751 (I2C temperature sensor library)
 * Takuo WATANABE (wtakuo)
 * http://mbed.org/users/takuo/code/ACM1602NI/
 */

#include "mbed.h"
#include "STTS751.h"

// I2C pins: p9 = sda, p10 = scl
STTS751 temp(p9, p10);

// You can specify an I2C object instead.
// I2C i2c(p9, p10);
// STTS751 temp(i2c);

int main() {
    // set the temperature resolution to 12bits
    temp.setResolution(STTS751::RES_12);
    while (true) {
        printf("temp: %.4f\n", (float)temp);
        wait(1);
    }
}