Test code for LM75AIM
main.cpp
- Committer:
- edodm85
- Date:
- 2012-06-27
- Revision:
- 0:75c4b60db793
- Child:
- 2:4dc9d2360484
File content as of revision 0:75c4b60db793:
/* * Author: Edoardo De Marchi * Date: 16-05-2011 * Notes: Read temperature from LM75AIM */ #include "mbed.h" #include "LM75A.h" Serial pc(USBTX, USBRX); LM75A temp(p28, p27, 0x90); //SDA, SCL, ADDRESS int main(){ int n = 0; while(1){ float var = temp.read(); pc.printf("The temp is: %4.2f degree Celsius\n\r", var); temp.read_reg(0x01); if(n == 3){ temp.write_reg(0x01, 0x03); n = 0; }else{ temp.write_reg(0x01, 0x00); } n++; wait(2); } }