naveen

Dependencies:   GPS TextLCD mbed

Fork of AnalogIn-HelloWorld by Mbed

Files at this revision

API Documentation at this revision

Comitter:
sathguru
Date:
Sun Apr 19 11:01:15 2015 +0000
Parent:
1:0a8f602aeec9
Commit message:
6 sensor

Changed in this revision

GPS.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 0a8f602aeec9 -r f1a2f4029bd6 GPS.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GPS.lib	Sun Apr 19 11:01:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/keerthanasp/code/GPS/#c5d054086f2c
diff -r 0a8f602aeec9 -r f1a2f4029bd6 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sun Apr 19 11:01:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 0a8f602aeec9 -r f1a2f4029bd6 main.cpp
--- a/main.cpp	Wed Dec 10 16:19:08 2014 -0600
+++ b/main.cpp	Sun Apr 19 11:01:15 2015 +0000
@@ -17,24 +17,203 @@
 #include "mbed.h"
 
 // Initialize a pins to perform analog input and digital output fucntions
-AnalogIn   ain(A0);
+AnalogIn   ph(A0);
+AnalogIn   CuAm(A1);
+AnalogIn   Na(A2);
+AnalogIn   Cutemp(A3);
+AnalogIn   Disoxy(A4);
+AnalogIn   flu(A5);
+Serial uart(p28, p27); //Pin 28 TX, pin 27 RX. 
+
+   char a;
+
 DigitalOut dout(LED1);
+#include "TextLCD.h"
+ DigitalOut myled(LED1);
+ DigitalOut myled1(LED2);
+ DigitalOut myled2(LED3);
+ DigitalOut myled3(LED4);
+TextLCD lcd(p26, p25, p24, p23, p22, p21); // rs, e, d4-d7
 
+float ph1,Am,Ni1,temp,Do,Sod,fl;
+float CuAm1;
+
+void send_ph(unsigned int s)
+{
+ unsigned int a;
+ unsigned char b,c,d,e,f;
+ a=s/10;
+ b=s%10;
+ c=a%10;
+ d=a/10;
+ e=d%10;
+ f=d/10;
+ putchar(f+0x30);
+ putchar(e+0x30);
+ putchar(c+0x30);
+ putchar(b+0x30);
+ putchar(0x0A);
+}
+
+
+float map(float x, float in_min, float in_max, float out_min, float out_max)
+{
+  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+}
 int main(void)
 {
+      lcd.locate(0,0);
+    lcd.printf("    Sensor \n");
+      lcd.locate(0,1);
+    lcd.printf("  Monitoring1  \n");
+      wait(1);
+         myled = 1;
+        myled1=1;
+        myled3=1;
+        myled2=1;
+        wait(0.5);
+        myled = 0;
+          myled = 0;
+        myled1=0;
+        myled3=0;
+        myled2=0;
+       
+        wait(0.5);
+  lcd.cls();
     while (1) {
         // test the voltage on the initialized analog pin
         //  and if greater than 0.3 * VCC set the digital pin
         //  to a logic 1 otherwise a logic 0
-        if(ain > 0.3f) {
-            dout = 1;
-        } else {
-            dout = 0;
-        }
+        //if(ain > 0.3f) {
+        //    dout = 1;
+        //} else {
+        //    dout = 0;
+       // }/
         
         // print the percentage and 16 bit normalized values
-        printf("percentage: %3.3f%%\n", ain.read()*100.0f);
-        printf("normalized: 0x%04X \n", ain.read_u16());
-        wait(0.2f);
+     
+        //lcd.printf(" Temperature \n");
+        ////////////////////////////////ph/////////////////////////////////
+        lcd.locate(0,0);
+        
+    
+ ph1=ph.read()*100;
+ph1=map(ph1,0,100,0,14);
+ lcd.printf("PH:%2.0f",ph1);
+   lcd.locate(0,0);
+        
+       lcd.locate(6,0);
+ Am=CuAm.read()*100;
+
+Am=map(Am,0,100,0.05,0);
+ if(Am<0.02)
+ {
+         lcd.printf("A:%2.3f", Am);  
+}
+else
+{
+        Am=0;
+        lcd.printf("A:%2.3f", Am);  
     }
+
+
+ 
+ /////////////////
+ 
+ 
+ 
+   
+lcd.locate(0,1);
+Sod=Na.read()*100;
+
+Sod=map(Sod,0,100,0,1);
+ if(Sod<0.75)
+{
+ lcd.printf("S:%2.1f", Sod);
 }
+else
+{
+ Sod=0;
+ lcd.printf("S:%2.1f", Sod);
+ }
+ 
+ 
+ 
+ ////////////////////////ni///////////////////////  
+Do=Disoxy.read()*100;
+Do=map(Do,0,200,0,1);
+ 
+ printf("%2.0f", Do);
+ 
+ ///////////////////////////////////////
+   
+lcd.locate(5,1);
+temp=Cutemp.read()*100;
+temp=map(temp,0,100,0,300);
+ lcd.printf(" T:%2.0f", temp);
+ 
+    
+   
+
+fl=flu.read()*100;
+fl=map(fl,0,100,0,2);
+if(fl<0.46)
+{
+    lcd.locate(13,0);
+   lcd.printf("Flu");
+   lcd.locate(11,1);
+lcd.printf("%2.2f", fl);
+ 
+}
+else
+{
+ fl=0;
+    lcd.locate(13,0);
+   lcd.printf("Flu");
+   lcd.locate(11,1);
+lcd.printf(" %2.2f", fl);
+}
+ 
+
+ 
+ a=uart.getc();
+  if (a=='A')
+  {
+ uart.printf("%2.1f", ph1);
+   uart.printf("\n");
+  }
+ 
+  else if (a=='B')
+ {
+ uart.printf("%2.3f", Am);
+  uart.printf("\n");
+  }
+/////////////////////////////////////////////////////////////////
+  else if (a=='C')
+  {
+ uart.printf("%2.1f", Sod);
+   uart.printf("\n");
+  }
+ 
+  else if (a=='D')
+ {
+ uart.printf("%2.0f",temp );
+  uart.printf("\n");
+  }
+ else if (a=='E')
+ {
+ uart.printf("%2.0f",Do );
+  uart.printf("\n");
+  }
+ else if (a=='F')
+ {
+ uart.printf("%2.2f",fl );
+  uart.printf("\n");
+  }
+
+
+
+
+
+}
+}
\ No newline at end of file
diff -r 0a8f602aeec9 -r f1a2f4029bd6 mbed.bld
--- a/mbed.bld	Wed Dec 10 16:19:08 2014 -0600
+++ b/mbed.bld	Sun Apr 19 11:01:15 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac
\ No newline at end of file