Projet s5 - sensors lib

Dependencies:   XBeeLib mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Sensors.h"
00003 #include "rtos.h"
00004 #include "xbeeutils.h"
00005 #include "ProcessControl.h"
00006 
00007 DigitalOut led1(LED1);
00008 DigitalOut led2(LED2);
00009 DigitalOut led3(LED3);
00010 DigitalOut led4(LED4);
00011 
00012 Serial pc(USBTX,USBRX);
00013 
00014 /*
00015 Thread * tPH;
00016 Thread * tTEMP;
00017 Thread * tEC;
00018 */
00019 
00020 int main() {
00021     
00022     int l1=0;
00023     //char buf[] = "1;2;0.5";
00024     
00025     //parameterToECOnly();
00026     
00027     pc.printf("initializing probes...\n\n");
00028     init_RTD();
00029     init_PH();
00030     init_EC();
00031     pc.printf("Probes initialized!\n\n");
00032     
00033     //xbee_init();
00034     
00035     //find_RTD();
00036     
00037     /*
00038     pc.printf("Getting probes information:\n");
00039     pc.printf("EC:");
00040     getInfo_EC();
00041     pc.putc('\n');
00042     
00043     
00044     pc.printf("RTD:");
00045     getInfo_RTD();
00046     pc.putc('\n');
00047     */
00048     
00049     pc.printf("Initializing system...");
00050     initSystem();
00051     drainSystem();
00052     pc.printf("\r                       ");
00053     pc.printf("System ready");
00054     
00055     while(1) {
00056             
00057         l1=!l1;
00058         led1=l1;
00059         wait(0.1);
00060         /*
00061         wait(1);
00062         pc.printf("pH:\n");
00063         read_PH();
00064         pc.printf("pH float: %f\n", getPH());
00065         
00066         wait(1);
00067         pc.printf("temp:\n");
00068         read_RTD();
00069         pc.printf("temp float: %f\n", getRTD());
00070         
00071         wait(1);
00072         pc.printf("EC:\n");
00073         read_EC();
00074         pc.printf("EC float : %f\n", getEC());
00075         */
00076     
00077         //pc.printf("Sending test data...\n");
00078         //send_data_to_coordinator(buf,strlen(buf));
00079         //test();
00080         //xbee_broadcast(buf,sizeof(buf));
00081         
00082         
00083         //getReadings();
00084         //process_rx_frames();
00085 
00086     }
00087 }