pro_EthBoiler

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of exe5_3_Ethernet_UDP_client by Zhengguo Sheng

Files at this revision

API Documentation at this revision

Comitter:
occle
Date:
Thu Jan 12 15:50:18 2017 +0000
Parent:
0:3527566e031c
Commit message:
pro_EthBoiler

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Dec 01 14:11:05 2016 +0000
+++ b/main.cpp	Thu Jan 12 15:50:18 2017 +0000
@@ -47,6 +47,8 @@
 DigitalOut green(LED_GREEN);    //debug led
 
 
+
+
 /*--VARIABLES---------------------------------------------------------------------------*/
 int n;                  //size of received message
 char in_buffer[1];      //create receive buffer
@@ -101,6 +103,7 @@
 
     while(true)                                                                             //repeat forever
     {
+        counter[0] = (counter[0] + 1)%11;                                                   //only count up to 10, then reset to 0
         pc.printf("\nCLIENT - Sending '%i' to server %s\r\n", counter[0], SERVER_IP);       //print message to send
         sock.sendTo(server, counter, sizeof(counter));                                      //send message
         
@@ -110,10 +113,14 @@
         
         in_buffer[n] = '\0';                                                                //add \0 to end of message
         pc.printf("CLIENT - Received '%i' from server %s\r\n", in_buffer[0], SERVER_IP);    //print message received
+        if(in_buffer[0] ==0)
+        {
+            //pwmout to turn on boiler if the message received is 0
+        }
+        else
+        //turn off boiler
         
-        counter[0] = (counter[0] + 1)%11;                                                   //only count up to 10, then reset to 0
-        
-        wait(1);                                                                            //wait 1 second
+        wait(30);                                                                            //wait 30 seconds
     }
     
 }   //end main()