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: ADS1115 BME280 CronoDot SDFileSystem mbed
Fork of Outdoor_UPAS_v1_2_powerfunction by
Diff: main.cpp
- Revision:
- 61:69ec677bf39f
- Parent:
- 59:4221935a12d8
- Child:
- 62:d26214c68686
--- a/main.cpp Tue May 24 20:52:26 2016 +0000
+++ b/main.cpp Wed May 25 19:58:03 2016 +0000
@@ -19,7 +19,7 @@
//Analog to Digital Converter
/////////////////////////////////////////////
Adafruit_ADS1115 ads(&i2c);
-Adafruit_ADS1115 ads2(&i2c);
+Adafruit_ADS1115 ads2(&i2c,0x49);
//DigitalIn ADS_ALRT(PA_10); //Connected but currently unused. (ADS1115) http://www.ti.com/lit/ds/symlink/ads1115.pdf
@@ -27,7 +27,7 @@
/////////////////////////////////////////////
//SD Card
/////////////////////////////////////////////
-char filename[] = "/sd/SHARP_LOG00.txt";
+char filename[] = "/sd/SHARP_working1.txt";
SDFileSystem sd(D11, D12, D13, D10, "sd"); // (MOSI, MISO, SCK, SEL)
//DigitalIn sdCD(PA_11, PullUp);
@@ -138,9 +138,9 @@
sharp4 = ads.readADC_SingleEnded(3, 0xF383); // read channel 1
sharpVolt4 = (sharp4*4.096)/(32768*1);
- sharp5 = ads2.readADC_SingleEnded(0, 0xC383); // read channel 1
+ sharp5 = ads2.readADC_SingleEnded(2, 0xE383); // read channel 1
sharpVolt5 = (sharp4*4.096)/(32768*1);
- sharp6 = ads2.readADC_SingleEnded(1, 0xD383); // read channel 1
+ sharp6 = ads2.readADC_SingleEnded(3, 0xf383); // read channel 1
sharpVolt6 = (sharp4*4.096)/(32768*1);
wait_us(deltaTime);
@@ -152,7 +152,15 @@
sharp5LED = 1;
sharp6LED = 1;
- pc.printf("%d,%f,%d,%f,\r\n" ,sharp5,sharpVolt5, sharp6, sharpVolt6);
+
+ pc.printf("%2.2f,%4.2f,%2.1f,%1.3f,", temp,press,rh,atmoRho);
+ pc.printf("%d,%d,%d,%d,",sharp1,sharp2,sharp3,sharp4);
+ pc.printf("%d,%d,",sharp5,sharp6);
+ pc.printf("%f,%f,%f,%f,",sharpVolt1,sharpVolt2,sharpVolt3,sharpVolt4);
+ pc.printf("%f,%f\r\n",sharpVolt5,sharpVolt6);
+
+ //pc.printf("%d,%d,%d,%d,%d,%d\r\n", sharp1, sharp2, sharp3, sharp4, sharp5, sharp6);
+ //pc.printf("%d,%f,%d,%f,\r\n" ,sharp5,sharpVolt5, sharp6, sharpVolt6);
//pc.printf("%d,%f,%d,%f,%d,%f,%d,%f\r\n" ,sharp1,sharpVolt1, sharp2, sharpVolt2,sharp3,sharpVolt3, sharp4, sharpVolt4);
//pc.printf("%2.2f,%4.2f,%2.1f,%1.3f\r\n", temp,press,rh,atmoRho);
//pc.printf("%d,%f,%d,%f\r\n" ,sharp3,sharpVolt3, sharp4, sharpVolt4);
@@ -160,13 +168,24 @@
FILE *fp = fopen(filename, "a");
// fprintf(fp, "%02d,%02d,%02d,%02d,%02d,%02d,",RTC_UPAS.year, RTC_UPAS.month,RTC_UPAS.date,RTC_UPAS.hour,RTC_UPAS.minutes,RTC_UPAS.seconds);
//fprintf(fp, "%s,", timestr);
- fprintf(fp, "%2.2f,%4.2f,%2.1f,%1.3f", temp,press,rh,atmoRho);
- fprintf(fp, "%d,%f,%d,%f," ,sharp1,sharpVolt1, sharp2, sharpVolt2);
- fprintf(fp, "%d,%f,%d,%f" ,sharp3,sharpVolt3, sharp4, sharpVolt4);
- fprintf("%d,%f,%d,%f,\r\n" ,sharp5,sharpVolt5, sharp6, sharpVolt6);
+
+
+ fprintf(fp, "%2.2f,%4.2f,%2.1f,%1.3f," ,temp,press,rh,atmoRho);
+ fprintf(fp, "%d,%d,%d,%d,",sharp1,sharp2,sharp3,sharp4);
+ fprintf(fp, "%d,%d,",sharp5,sharp6);
+ fprintf(fp, "%f,%f,%f,%f,",sharpVolt1,sharpVolt2,sharpVolt3,sharpVolt4);
+ fprintf(fp, "%f,%f\r\n",sharpVolt5,sharpVolt6);
+
fclose(fp);
free(fp);
+ /*fprintf(fp, "%2.2f,%4.2f,%2.1f,%1.3f", temp,press,rh,atmoRho);
+ fprintf(fp, "%d,%f,%d,%f,",sharp1, sharpVolt1, sharp2, sharpVolt2);
+ fprintf(fp, "%d,%f,%d,%f",sharp3,sharpVolt3, sharp4, sharpVolt4);
+ fprintf(fp, "%d,%f,%d,%f",sharp5, sharpVolt5, sharp6, sharpVolt6);
+ fclose(fp);
+ free(fp);
+ */
@@ -175,6 +194,29 @@
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
//////////////////////////////////////////////////////////////
//Main Function
//////////////////////////////////////////////////////////////
