Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- Mattinico
- Date:
- 2016-10-17
- Revision:
- 0:630a895826d4
File content as of revision 0:630a895826d4:
#include "mbed.h" I2C i2c(D14, D15); const int addr=0x90; int main() { char cmd[2]; printf("\r\nTCN75 I2C thermometer\r\n"); cmd[0]=0x01; cmd[0]=0x00; i2c.write(addr, cmd, 2); while(1){ wait(1); cmd[0]=0x00; i2c.write(addr, cmd, 1); i2c.read(addr, cmd, 2); float temp = cmd[0]<<8|cmd[1]; printf("Temperatue = %.4f C\r\n", temp/256); } }