Takuo WATANABE
/
STTS751_Demo
A demo program for STTS751 (I2C temperature sensor library)
Diff: main.cpp
- Revision:
- 2:9850512c9113
- Parent:
- 1:8fb0961c0dc8
- Child:
- 3:a2d2563ae3ef
--- a/main.cpp Sat Jan 18 02:36:42 2014 +0000 +++ b/main.cpp Sun Jan 19 03:16:15 2014 +0000 @@ -4,25 +4,20 @@ */ #include "mbed.h" - -// I2C Text LCD: http://mbed.org/users/takuo/code/ACM1602NI/ -#include "ACM1602NI.h" -// I2C Temperature Sensor: http://mbed.org/users/takuo/code/STTS751/ #include "STTS751.h" // I2C pins: p9 = sda, p10 = scl -ACM1602NI lcd(p9, p10); STTS751 temp(p9, p10); // You can specify an I2C object instead. // I2C i2c(p9, p10); -// ACM1602NI lcd(i2c); // STTS751 temp(i2c); int main() { + // set the temperature resolution to 12bits + temp.setResolution(STTS751::RES_12); while (true) { - lcd.locate(0, 0); - lcd.printf("temp: %.3f", (float)temp); + printf("temp: %.4f\n", (float)temp); wait(1); } }