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:
- 9:c97cd10b11ac
- Parent:
- 8:882ccc7bbc8a
- Child:
- 10:f5d4d5e30b9b
--- a/main.cpp Wed Apr 06 05:58:36 2016 +0000
+++ b/main.cpp Wed Apr 13 20:14:37 2016 +0000
@@ -6,6 +6,9 @@
Serial pc(USBTX,USBRX);
SPI spi(NC,PTD3,PTD1);
SPI sdspi(PTE3,PTE1,PTE2);
+DigitalIn eject(PTA4); // INT2
+DigitalOut greenLed(LED2);
+DigitalOut redLed(LED1);
MAX31855 thermometer1(spi,PTC4);
MAX31855 thermometer2(spi,PTC3);
@@ -15,6 +18,8 @@
int main()
{
+ greenLed = 1;
+ redLed = 0;
float temp1, temp2;
float lastTime = 0;
float dt = 0.5;
@@ -25,13 +30,19 @@
openDataFile();
float timeReset = 0;
while (halfHour<=6) {
-
- if (t.read()>lastTime+dt) {
+ if (eject == 0) {
+ greenLed = 0;
+ redLed = 1;
+ break;
+ }
+
+ else if (t.read()>lastTime+dt) {
lastTime = t.read();
timeReset = 30*60*halfHour+lastTime;
temp1 = thermometer1.read();
+ wait(.02);
temp2 = thermometer2.read();
- voltage = solarPanel.read(); // I will need to put the voltage reading in here.
+ voltage = solarPanel.read();
pc.printf("Voltage %f\t Temp1 %f\t Temp2 %f\t Time %f\r\n", voltage, temp1, temp2, lastTime);
writeData(lastTime, temp1, temp2, voltage);
