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:
- 11:1e56b710b568
- Parent:
- 10:f5d4d5e30b9b
--- a/main.cpp Wed Apr 13 20:26:40 2016 +0000
+++ b/main.cpp Sun May 15 02:32:40 2016 +0000
@@ -10,16 +10,22 @@
DigitalOut greenLed(LED2);
DigitalOut redLed(LED1);
-MAX31855 thermometer1(spi,PTC4);
-MAX31855 thermometer2(spi,PTC3);
+MAX31855 thermometer1(spi,PTB9);
+MAX31855 thermometer2(spi,PTD0);
AnalogIn solarPanel(PTB2);
Timer t;
int main()
{
+ const int secondsHalfHour = 30*60; //number of seconds in 1 half hour
+ redLed = 0;
greenLed = 1;
- redLed = 0;
+ wait(0.5);
+ redLed = 1;
+ greenLed = 0;
+ wait(0.5);
+ greenLed = 1;
float temp1, temp2;
float lastTime = 0;
float dt = 0.5;
@@ -29,26 +35,31 @@
t.start();
mountSDCard();
openDataFile();
- while (halfHour<=6) {
+ while (halfHour<6) {
if (eject == 0) {
greenLed = 0;
- redLed = 1;
+ wait(0.5);
+ greenLed = 1;
break;
}
- totalTime = 30*60*halfHour + t.read();
+ totalTime = secondsHalfHour*halfHour + t.read();
if (totalTime>lastTime+dt) {
lastTime = totalTime;
temp1 = thermometer1.read();
wait(.02);
temp2 = thermometer2.read();
- voltage = solarPanel.read();
+ voltage = 3.3*(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);
}
- if (t.read()>=30*60){
+ if (t.read()>=secondsHalfHour){
halfHour++;
t.reset();
}
}
closeDataFile();
+ greenLed = 0;
+ while(true){
+
+ }
}
\ No newline at end of file
