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.
Dependencies: MAX31855 SDFileSystem mbed
main.cpp@0:42e8fa13c7a9, 2016-03-03 (annotated)
- Committer:
- DanielBlomdahl
- Date:
- Thu Mar 03 16:24:22 2016 +0000
- Revision:
- 0:42e8fa13c7a9
- Child:
- 1:8116bd9d3c46
Initial copy-and-paste from Dr. Larkin. Includes capability for more than one thermometer.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| DanielBlomdahl | 0:42e8fa13c7a9 | 1 | #include "mbed.h" |
| DanielBlomdahl | 0:42e8fa13c7a9 | 2 | #include "TMP102.h" |
| DanielBlomdahl | 0:42e8fa13c7a9 | 3 | |
| DanielBlomdahl | 0:42e8fa13c7a9 | 4 | I2C i2c(PTE25, PTE24); |
| DanielBlomdahl | 0:42e8fa13c7a9 | 5 | TMP102 temperature(i2c,0x90); // i2c, address |
| DanielBlomdahl | 0:42e8fa13c7a9 | 6 | /* The TMP102 board has an address of 0x90 if ADD0 is connected to ground */ |
| DanielBlomdahl | 0:42e8fa13c7a9 | 7 | |
| DanielBlomdahl | 0:42e8fa13c7a9 | 8 | Serial pc(USBTX,USBRX); |
| DanielBlomdahl | 0:42e8fa13c7a9 | 9 | |
| DanielBlomdahl | 0:42e8fa13c7a9 | 10 | int main() |
| DanielBlomdahl | 0:42e8fa13c7a9 | 11 | { |
| DanielBlomdahl | 0:42e8fa13c7a9 | 12 | float currentTemp; |
| DanielBlomdahl | 0:42e8fa13c7a9 | 13 | while (true) { |
| DanielBlomdahl | 0:42e8fa13c7a9 | 14 | currentTemp = temperature.read(); |
| DanielBlomdahl | 0:42e8fa13c7a9 | 15 | pc.printf("T = %.2fC\r\n", currentTemp); |
| DanielBlomdahl | 0:42e8fa13c7a9 | 16 | wait(0.5); |
| DanielBlomdahl | 0:42e8fa13c7a9 | 17 | } |
| DanielBlomdahl | 0:42e8fa13c7a9 | 18 | } |
