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.
Fork of 4_LCD_With_Lib by
Revision 2:1a5d54f3d818, committed 2013-11-04
- Comitter:
- prathapbmsce
- Date:
- Mon Nov 04 22:25:41 2013 +0000
- Parent:
- 1:71e371ba55cd
- Commit message:
- EMS_Final_5/11/13
Changed in this revision
--- a/TextLCD.lib Sun Oct 06 05:12:49 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mamezu/code/TextLCD/#ffeb3e6c1367
--- a/main.cpp Sun Oct 06 05:12:49 2013 +0000
+++ b/main.cpp Mon Nov 04 22:25:41 2013 +0000
@@ -1,18 +1,91 @@
-
#include "mbed.h"
#include "TextLCD.h"
-AnalogIn s1(p18);
+
+AnalogIn sm1(p18);
+DigitalOut relay(p30);
+
+Serial GPRS(p9,p10);
+Serial pc(USBTX, USBRX); // tx, rx
-TextLCD lcd(p19,p20, p21, p22, p23, p24); // rs, e, d4, d5, d6, d7
+TextLCD lcd(p26, p25, p24, p23, p22, p21); // rs, e, d4, d5, d6, d7
+
+LocalFileSystem local("local");
+
+char z=0x1A,e=0x22,c=0x0d; // ASCII equivalent of 0X22 is "(Double invited coma)
+char num[]="9535811293"; // Mobile phone number to which emergancy information has to be delivered
int main()
{
+float a,m;
+int b=100,time=0;
+
while(1)
{
- float x;
- lcd.cls();
- x=s1.read();
- lcd.printf("Sensor value = %f",x);
- wait(0.5);
-}
+ GPRS.baud(9600);
+ GPRS.printf("AT+CMGF=1\r\n");
+ q=m; //Storing the sensor value in a variable
+
+ //Sensor read and Callibrate
+ a=sm1.read();
+ m=(0.057*(a*1024))+25.072;
+ lcd.cls();
+ lcd.printf("Raw SM1=%0.3f",a);
+ wait(5);
+
+ //Local storage (On board flash memory of 2MB)
+ FILE *fp=fopen("/local/KAEMS.csv","a");
+ fprintf(fp,"%d,%0.3f\n",time,m);
+ fclose(fp);
+ lcd.cls();
+ lcd.printf("File updated");
+ wait(5);
+
+ //Display
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("SM1=%0.3f",m);
+ wait(5);
+
+ //Realy control
+ if(m>50)
+ relay=0;
+ else
+ relay=1;
+ wait(2);
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("Relay Function...");
+
+ //GPRS commands
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("Updating BMSEMS...");
+ wait(3);
+ GPRS.printf("AT+SAPBR=0,1\r\n");
+ wait(3);
+ GPRS.printf("AT+SAPBR=3,1,%cCONTYPE%c,%cGPRS%c\r\n",e,e,e,e);
+ wait(3);
+ GPRS.printf("AT+SAPBR=3,1,%cAPN%c,%cwww%c\r\n",e,e,e,e);
+ wait(3);
+ GPRS.printf("AT+SAPBR=1,1\r\n");
+ wait(5);
+ GPRS.printf("AT+HTTPINIT\r\n");
+ wait(2);
+ GPRS.printf("AT+HTTPPARA=%cCID%c,1\r\n",e,e);
+ wait(2);
+ GPRS.printf("AT+HTTPPARA=%cURL%c,%chttp://bmsems.org/update.php?u=3&t=23&h=34&s1=%f&s2=24&s3=25&s4=26&ph=5&b=%d%c\r\n",e,e,e,m,b--,e);
+ wait(2);
+ GPRS.printf("AT+HTTPDATA=1000,5000\r\n");
+ wait(10);
+ GPRS.printf("AT+HTTPACTION=1\r\n");
+ wait(5);
+ GPRS.printf("AT+HTTPTERM\r\n");
+ wait(5);
+
+ time=time+1;
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("BMSEMS Updated");
+ wait(10);
+ }
}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project.lib Mon Nov 04 22:25:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mamezu/code/TextLCD/#ffeb3e6c1367
