scott kelleher / Outdoor_UPAS_sharp_octet

Dependencies:   ADS1115 BME280 CronoDot SDFileSystem mbed

Fork of Outdoor_UPAS_v1_2_powerfunction by scott kelleher

Files at this revision

API Documentation at this revision

Comitter:
scottkelleher
Date:
Wed May 25 22:38:12 2016 +0000
Parent:
61:69ec677bf39f
Child:
63:4bb4e27d057e
Commit message:
sharp2-6 fix

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed May 25 19:58:03 2016 +0000
+++ b/main.cpp	Wed May 25 22:38:12 2016 +0000
@@ -73,6 +73,7 @@
 
 int samplingTime = 280;
 int deltaTime = 40;
+int sleepTime= 9680
 int sharp1, sharp2, sharp3, sharp4, sharp5, sharp6;
 float sharpVolt1, sharpVolt2, sharpVolt3, sharpVolt4, sharpVolt5, sharpVolt6; //V
 
@@ -121,15 +122,55 @@
     //pc.printf("%f,%f,%f,%f\r\n", temp, press, rh, atmoRho);
     
     sharp1LED = 0;
+    wait_us(samplingTime);
+    sharp1 = ads.readADC_SingleEnded(0, 0xC383); // read channel 1
+    sharpVolt1 = (sharp1*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp1LED = 1;
+    wait_us(sleepTime)
+    
     sharp2LED = 0;
+    wait_us(samplingTime);
+    sharp2 = ads.readADC_SingleEnded(1, 0xD383); // read channel 1
+    sharpVolt2 = (sharp2*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp2LED = 1;
+    wait_us(sleepTime)
+    
     sharp3LED = 0;
+    wait_us(samplingTime);
+    sharp3 = ads.readADC_SingleEnded(2, 0xE383); // read channel 1
+    sharpVolt3 = (sharp3*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp3LED = 1;
+    wait_us(sleepTime)
+    
     sharp4LED = 0;
+    wait_us(samplingTime);
+    sharp4 = ads.readADC_SingleEnded(3, 0xF383); // read channel 1
+    sharpVolt4 = (sharp4*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp4LED = 1;
+    wait_us(sleepTime)
+    
     sharp5LED = 0;
+    wait_us(samplingTime);
+    sharp5 = ads2.readADC_SingleEnded(0, 0xC383); // read channel 1
+    sharpVolt5 = (sharp5*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp5LED = 1;
+    wait_us(sleepTime)
+    
     sharp6LED = 0;
-      
     wait_us(samplingTime);
+    sharp6 = ads2.readADC_SingleEnded(0, 0xD383); // read channel 1
+    sharpVolt6 = (sharp6*4.096)/(32768*1);
+     wait_us(deltaTime)
+    sharp6LED = 1;
+    wait_us(sleepTime)
+   
     
-    sharp1 = ads.readADC_SingleEnded(0, 0xC383); // read channel 1
+   /* sharp1 = ads.readADC_SingleEnded(0, 0xC383); // read channel 1
     sharpVolt1 = (sharp1*4.096)/(32768*1);
     sharp2 = ads.readADC_SingleEnded(1, 0xD383); // read channel 1
     sharpVolt2 = (sharp2*4.096)/(32768*1);
@@ -151,7 +192,7 @@
     sharp4LED = 1;
     sharp5LED = 1;
     sharp6LED = 1;
-    
+    */
     
     pc.printf("%2.2f,%4.2f,%2.1f,%1.3f,", temp,press,rh,atmoRho);
     pc.printf("%d,%d,%d,%d,",sharp1,sharp2,sharp3,sharp4);