dsadd

Dependencies:   mbed Sht31 MAX44009

Files at this revision

API Documentation at this revision

Comitter:
chapman515
Date:
Fri Apr 24 13:33:28 2020 +0000
Parent:
8:cca99ce7c5bc
Child:
10:a9db57e6456e
Commit message:
FYP

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Apr 24 04:10:14 2020 +0000
+++ b/main.cpp	Fri Apr 24 13:33:28 2020 +0000
@@ -9,7 +9,7 @@
 MAX44009 myMAX44009 ( p9, p10, MAX44009::MAX44009_ADDRESS_A0_GND, 400000 );
 I2C i2c(p9, p10); //pins for I2C communication (SDA, SCL)
 
-DigitalOut Batt2SYS(p8);
+InterruptIn smthing_from_BLE(p12);
 DigitalOut BLE_Can_receive(p11); // 0 = can recieve
 
 class RGB{
@@ -46,15 +46,23 @@
 char    signal[1];
 //LocalFileSystem local("local"); //Create the local filesystem under the name "local"
 
+ void letsee() {
+            led=!led;
+            pc.scanf("%1s", signal);
+            wrote=true;
+}
+
+
+
 
 int main()
 {   
   //  set_time(1587699064); 
- 
+    led=1;
     //pc.read
+    BLE_Can_receive = 0;
     pc.baud ( 19200 );
-    Batt2SYS = 0;
-
+    smthing_from_BLE.fall(&letsee);
  
        
     while(1) { 
@@ -194,7 +202,7 @@
             
         //pc.printf("test");
        // pc.printf("Shine Like:%s,%d,%d,%d,%d,%3.2f,%3.2f%,%0.001f\n",signal,(int)(RGBavg.C+0.5), (int)(RGBavg.R+0.5), (int)(RGBavg.G+0.5), (int)(RGBavg.B+0.5),THavg.t, THavg.h,luxavg);
-            BLE_Can_receive = 0;
+            //BLE_Can_receive = 0;
             counter++;
            // if (counter == 10 &&_30Scounter==3){
                 //_30Scounter=0;
@@ -209,7 +217,7 @@
                // _30Scounter++;
                  allfilled = true; 
             }
-            BLE_Can_receive = 1;
+            //BLE_Can_receive = 1;
         if (wrote){
            /* if (signal[0]=='s'){
                 FILE *fp = fopen("/local/out.txt", "r"); 
@@ -240,14 +248,6 @@
                 }
             
         }
-        else{
-            if(pc.readable() ) {
-                led=!led;
-                pc.scanf("%1s", signal);
-                wrote=true;
-            }
-    
-        }
 
 
     }