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@1:8116bd9d3c46, 2016-03-08 (annotated)
- Committer:
- DanielBlomdahl
- Date:
- Tue Mar 08 16:44:14 2016 +0000
- Revision:
- 1:8116bd9d3c46
- Parent:
- 0:42e8fa13c7a9
- Child:
- 2:a2966bf82e8c
initial copy of Larkin's Code. Still trying to find useful library;
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 | |
| DanielBlomdahl | 1:8116bd9d3c46 | 3 | DigitalOut myled(LED1); |
| DanielBlomdahl | 1:8116bd9d3c46 | 4 | SPI spi(p13,NC,p15); |
| DanielBlomdahl | 1:8116bd9d3c46 | 5 | //MAX31855 temperature(spi,0x90); // i2c, address |
| DanielBlomdahl | 1:8116bd9d3c46 | 6 | /* The MAX31855 board has an address of 0x90 if ADD0 is connected to ground */ |
| DanielBlomdahl | 1:8116bd9d3c46 | 7 | MAX31855 thermometer1(spi,p15); |
| DanielBlomdahl | 1:8116bd9d3c46 | 8 | MAX31855 thermometer2(spi,p16); |
| DanielBlomdahl | 1:8116bd9d3c46 | 9 | Timer t; |
| DanielBlomdahl | 0:42e8fa13c7a9 | 10 | |
| DanielBlomdahl | 0:42e8fa13c7a9 | 11 | int main() |
| DanielBlomdahl | 0:42e8fa13c7a9 | 12 | { |
| DanielBlomdahl | 1:8116bd9d3c46 | 13 | float temp1, temp2; |
| DanielBlomdahl | 1:8116bd9d3c46 | 14 | float lastTime = 0; |
| DanielBlomdahl | 1:8116bd9d3c46 | 15 | float dt = 0.5; |
| DanielBlomdahl | 1:8116bd9d3c46 | 16 | t.start(); |
| DanielBlomdahl | 1:8116bd9d3c46 | 17 | |
| DanielBlomdahl | 1:8116bd9d3c46 | 18 | while (1) { |
| DanielBlomdahl | 1:8116bd9d3c46 | 19 | if t.read()>lastTime+dt) { |
| DanielBlomdahl | 1:8116bd9d3c46 | 20 | lastTime = t.read()l |
| DanielBlomdahl | 1:8116bd9d3c46 | 21 | temp1 = thermometer1.read(); |
| DanielBlomdahl | 1:8116bd9d3c46 | 22 | temp2 = thermometer2.read(); |
| DanielBlomdahl | 1:8116bd9d3c46 | 23 | writeData(lastTime, temp1, temp2); |
| DanielBlomdahl | 1:8116bd9d3c46 | 24 | |
| DanielBlomdahl | 0:42e8fa13c7a9 | 25 | } |
| DanielBlomdahl | 0:42e8fa13c7a9 | 26 | } |
