Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TmpLM74 Class Reference
An LM74 based digital thermometer. More...
#include <TmpLM74.h>
Detailed Description
An LM74 based digital thermometer.
Currently supports SPI peripheral interface
#include "mbed.h" #include "tmpLM74.h" Serial pc(USBTX, USBRX); // tx, rx DigitalOut myled(LED1); TmpLM74 Temp74(p5, p6, p7, p8); // mbed connections: // mosi(p5) to LM74 pin 1, through 10k // miso(p6) to LM74 pin 1 // sclk(p7) to LM74 pin 2 // miso(p8) to LM74 pin 7 //TmpLM74.startLM74(); // CAN be used, but NOT necessary (invoked within readTemp(), if needed) int main() { float TempC; pc.printf("HELLO!, testing LM74 temperature sensor ...\n\r"); for (int i = 0; i < 10; i++){ wait(2); TempC = Temp74.readTemp(); pc.printf("Temperature = "); if(TempC > MAX_LM74_TEMP) { // check whether temp is valid pc.printf(" ? *C\n", TempC); } else { pc.printf("%3.1f *C\n", TempC); } myled = !myled; } Temp74.shutLM74down(); while(1){ wait(1); myled = !myled; } }
Generated on Wed Jul 20 2022 01:50:12 by
1.7.2