LM75Bをmbed LPC1114FN28に繋げて、温度をシリアルコンソールに出力するプログラム
Fork of LM75B_HelloWorld by
Diff: main.cpp
- Revision:
- 0:578bc3c56500
- Child:
- 1:94af70628683
diff -r 000000000000 -r 578bc3c56500 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 14 05:03:01 2013 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "LM75B.h" + +LM75B sensor(p28, p27, LM75B::ADDRESS_0); + +int main() { + while (1) { + //Read the temperature + float temp = sensor.temp(); + + //Print the temperature + printf("Temp = %.3f\n", temp); + + //Sleep for 0.5 seconds + wait(0.5); + } +}