kjdas

Dependencies:   BME280 BMP280 TextLCD mbed

Fork of CW_sd_0801 by Calvin Kalintra

Files at this revision

API Documentation at this revision

Comitter:
ckalintra
Date:
Tue Jan 09 11:26:15 2018 +0000
Parent:
1:dc21a6fce3af
Commit message:
code;

Changed in this revision

data.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
putty.h Show annotated file Show diff for this revision Revisions of this file
--- a/data.h	Mon Jan 08 18:46:57 2018 +0000
+++ b/data.h	Tue Jan 09 11:26:15 2018 +0000
@@ -6,7 +6,7 @@
 float lvl;
 float data_temp [119], data_press[119], data_light[119];
 int date_a[199], time_a[199], time0_a[199], date0_a[199];
-BME280 bmp(D14,D15,0x76);
+BMP280 bmp(D14,D15,0x76);
 
 AnalogIn LDR(A0);
 int counterw = 0, full = 0, day, month, year, leap;
--- a/main.cpp	Mon Jan 08 18:46:57 2018 +0000
+++ b/main.cpp	Tue Jan 09 11:26:15 2018 +0000
@@ -8,10 +8,12 @@
 Ticker display;
 Ticker second_pass;
 InterruptIn button(USER_BUTTON);
-
+DigitalOut led(PB_11), led2(PB_10);
 //NVIC_SetPriority(display, 0);     
 //NVIC_SetPriority(second_pass, 1);
 //NVIC_SetPriority(button, 1);
+
+
 void second_tick()
 {
     ss++;
@@ -23,31 +25,35 @@
         lcd.locate(10,0);
         lcd.printf("l:%1.2f", lvl);
         lcd.locate(0,0);
-        lcd.printf("p:%3.1f", pressuref);
+        lcd.printf("p:%5.1f", pressuref);
         lcd.locate(10,1);
         lcd.printf("t:%2.1f", tempf);
-        display_time();
+        display_time(); 
     }
-    
     else if (dislcd == 0)
     {
         display_dates();
         display_time();
     }
+   
+       //VIC_SystemReset();
 }
 
 void lcddisp()
 { 
     if (gather_data == 1)
     {
+        led2 = 1;
         display_time();
         getdata();
         store();
-        
+        led2 = 0;
     }
     if (gather_data ==0)
     {
-        
+        led = 1;
+        wait(0.2);
+        led = 0;
     }
 }
 
@@ -63,29 +69,28 @@
 int main()
 {
     lcd.cls();
+    
     //display_date_time();
 //    while (pointer != 14)
 //    {
 //        select_date();
 //    }
     bmp.initialize();
-    pc.printf("putty ready\n\r");
+    pc.printf("\n\rputty ready\n\r");
     display.attach(&lcddisp, T);
     second_pass.attach(&second_tick, 1.0);
     button.rise(&check_display);
-    
-    
     while(1)
     {
-            check_display();
-            putty_write();
-            check_display();
-            if (interrupt == 1)
-            {
-                T = t;
-                display.attach(&lcddisp, T);
-                interrupt = 0;
-            }
+        check_display();
+        putty_write();
+        check_display();
+        if (interrupt == 1)
+        {
+            T = t;
+            display.attach(&lcddisp, T);
+            interrupt = 0;
+        }
     }
 }
     
--- a/putty.h	Mon Jan 08 18:46:57 2018 +0000
+++ b/putty.h	Tue Jan 09 11:26:15 2018 +0000
@@ -275,28 +275,27 @@
 void putty_write ()
 {
     int count = 0;
-            int wcount = 0;
-            while (user_command[wcount]!= ' ')
-            {
-                user_command[count] = pc.getc();
-                pc.putc(user_command[count]);
-                count++;
-                wcount = count -1;
-            }
-            int count2 = 0;
-            int wcount2 = 0;
-            while(user_command2[wcount2]!= '\r')
-            {
-                user_command2[count2] = pc.getc();
-                pc.putc(user_command2[count2]);
-                count2++;
-                wcount2 = count2 -1;
-            }
-            
-            
-            pc.printf("you typed: %s %s\n\r",user_command,user_command2);
-            selection();
-            clear();
-            clear2();  
-            
+    int wcount = 0;
+    while (user_command[wcount]!= ' ')
+    {
+        user_command[count] = pc.getc();
+        pc.putc(user_command[count]);
+        count++;
+        wcount = count -1;
+    }
+    int count2 = 0;
+    int wcount2 = 0;
+    while(user_command2[wcount2]!= '\r')
+    {
+        user_command2[count2] = pc.getc();
+        pc.putc(user_command2[count2]);
+        count2++;
+        wcount2 = count2 -1;
+    }
+    
+    pc.printf("you typed: %s %s\n\r",user_command,user_command2);
+    selection();
+    clear();
+    clear2();  
+    
 }
\ No newline at end of file