LM75Bをmbed LPC1114FN28に繋げて、温度をシリアルコンソールに出力するプログラム

Dependencies:   LM75B mbed

Fork of LM75B_HelloWorld by Neil Thiessen

Committer:
neilt6
Date:
Wed Aug 14 05:03:01 2013 +0000
Revision:
0:578bc3c56500
Child:
1:94af70628683
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
neilt6 0:578bc3c56500 1 #include "mbed.h"
neilt6 0:578bc3c56500 2 #include "LM75B.h"
neilt6 0:578bc3c56500 3
neilt6 0:578bc3c56500 4 LM75B sensor(p28, p27, LM75B::ADDRESS_0);
neilt6 0:578bc3c56500 5
neilt6 0:578bc3c56500 6 int main() {
neilt6 0:578bc3c56500 7 while (1) {
neilt6 0:578bc3c56500 8 //Read the temperature
neilt6 0:578bc3c56500 9 float temp = sensor.temp();
neilt6 0:578bc3c56500 10
neilt6 0:578bc3c56500 11 //Print the temperature
neilt6 0:578bc3c56500 12 printf("Temp = %.3f\n", temp);
neilt6 0:578bc3c56500 13
neilt6 0:578bc3c56500 14 //Sleep for 0.5 seconds
neilt6 0:578bc3c56500 15 wait(0.5);
neilt6 0:578bc3c56500 16 }
neilt6 0:578bc3c56500 17 }