Test code for LM75AIM
Diff: main.cpp
- Revision:
- 0:75c4b60db793
- Child:
- 2:4dc9d2360484
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 27 15:45:09 2012 +0000 @@ -0,0 +1,35 @@ +/* + * 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); + } + + + +}