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
00001 #include "mbed.h" 00002 I2C i2c(D14, D15); 00003 const int addr=0x90; 00004 int main() { 00005 char cmd[2]; 00006 printf("\r\nTCN75 I2C thermometer\r\n"); 00007 cmd[0]=0x01; 00008 cmd[0]=0x00; 00009 i2c.write(addr, cmd, 2); 00010 while(1){ 00011 wait(1); 00012 cmd[0]=0x00; 00013 i2c.write(addr, cmd, 1); 00014 i2c.read(addr, cmd, 2); 00015 float temp = cmd[0]<<8|cmd[1]; 00016 printf("Temperatue = %.4f C\r\n", temp/256); 00017 } 00018 00019 }
Generated on Tue Jul 12 2022 23:14:29 by
1.7.2