Srinivasan Ramasamy
/
EC
Water quality
Revision 0:ef33eee73e62, committed 2014-12-23
- Comitter:
- ramsphd
- Date:
- Tue Dec 23 10:24:43 2014 +0000
- Commit message:
- Electrical conductivity
Changed in this revision
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 000000000000 -r ef33eee73e62 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 23 10:24:43 2014 +0000 @@ -0,0 +1,71 @@ +#include "mbed.h" +#include <stdio.h> + + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); +Serial async_port(p9,p10); + + +int main() { + char A[100]; + char *pch; + int t=0; + + pc.printf("EC = "); + async_port.baud(38400); + //async_port.puts("27,b\r"); + + //async_port.puts("C0\r"); + + /*async_port.puts("O,S,1\r"); + wait(1); + async_port.puts("O,SG,1\r"); + wait(1); + async_port.puts("O,TDS,1\r"); + wait(1); + async_port.puts("O,EC,1\r"); + wait(1);*/ + async_port.puts("R\r"); + + //async_port.puts("L,1\r"); + + + //async_port.puts("K,1.0\r"); + //async_port.puts("Cal,dry\r"); + //async_port.puts("Cal,high,80000\r"); + //async_port.puts("Cal,low,12800\r"); + //async_port.puts("Cal,?\r"); + + wait(1); + async_port.gets(A,20); + //pc.printf(A); + pc.printf("\n\r"); + pch = strtok (A,","); + + while (pch != NULL) + { + switch(t) + { + case 0: pc.printf ("EC = %s\n",pch); break; + case 1: pc.printf ("TDS = %s\n",pch); break; + case 2: pc.printf ("SAL = %s\n",pch); break; + case 3: pc.printf ("SG = %s\n",pch); break; + + } + t++; + pch = strtok (NULL, ","); + } + /* wait(10); + pc.printf("TDS="); + async_port.puts("O,TDS,1\r"); + async_port.puts("O,EC,0\r"); + async_port.puts("R\r"); + wait(10); + async_port.gets(A,6); + pc.printf(A); + pc.printf("\n\r"); + */ + + + }
diff -r 000000000000 -r ef33eee73e62 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 23 10:24:43 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file