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
Diff: main.cpp
- Revision:
- 1:8116bd9d3c46
- Parent:
- 0:42e8fa13c7a9
- Child:
- 2:a2966bf82e8c
diff -r 42e8fa13c7a9 -r 8116bd9d3c46 main.cpp
--- a/main.cpp Thu Mar 03 16:24:22 2016 +0000
+++ b/main.cpp Tue Mar 08 16:44:14 2016 +0000
@@ -1,18 +1,26 @@
#include "mbed.h"
-#include "TMP102.h"
-I2C i2c(PTE25, PTE24);
-TMP102 temperature(i2c,0x90); // i2c, address
-/* The TMP102 board has an address of 0x90 if ADD0 is connected to ground */
-
-Serial pc(USBTX,USBRX);
+DigitalOut myled(LED1);
+SPI spi(p13,NC,p15);
+//MAX31855 temperature(spi,0x90); // i2c, address
+/* The MAX31855 board has an address of 0x90 if ADD0 is connected to ground */
+MAX31855 thermometer1(spi,p15);
+MAX31855 thermometer2(spi,p16);
+Timer t;
int main()
{
- float currentTemp;
- while (true) {
- currentTemp = temperature.read();
- pc.printf("T = %.2fC\r\n", currentTemp);
- wait(0.5);
+ float temp1, temp2;
+ float lastTime = 0;
+ float dt = 0.5;
+ t.start();
+
+ while (1) {
+ if t.read()>lastTime+dt) {
+ lastTime = t.read()l
+ temp1 = thermometer1.read();
+ temp2 = thermometer2.read();
+ writeData(lastTime, temp1, temp2);
+
}
}
\ No newline at end of file
