#include #include #include #include #include #define LM75 72 // ! Linux remove the R/W-Bit from Adress ! int main(int argc,char** argv) { int f = open("/dev/i2c/0",O_RDWR); char buf[2]; if (f>0) { ioctl(f,I2C_SLAVE,LM75); if (-1 == read(f,buf,2)) { printf("read error.\n"); } else { /* calc. temparature*/ int temp = buf[0]*256+buf[1]; temp >>=7; if (temp>512) temp &= -1; printf("%g Grad Celsius\n", (float)temp/2.0); } } return close(f); }