Sensos Module Updated

Dependents:   SmartLabProyect

Fork of Middleware by Roberto Herrera

Committer:
Jorge_Beltran
Date:
Thu Dec 10 03:03:11 2015 +0000
Revision:
4:c59485faea9f
Parent:
0:d1ff330c5128
Updated Sensors Module Added GetLightFuncion

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RoHe 0:d1ff330c5128 1 /*
RoHe 0:d1ff330c5128 2 Ether.cpp
RoHe 0:d1ff330c5128 3
RoHe 0:d1ff330c5128 4 Only to improve the clarity of main .cpp
RoHe 0:d1ff330c5128 5 This don't have any new classes
RoHe 0:d1ff330c5128 6
RoHe 0:d1ff330c5128 7 All the multiple task are here
RoHe 0:d1ff330c5128 8 for Smart Room project asked by
RoHe 0:d1ff330c5128 9 Gustavo Torres
RoHe 0:d1ff330c5128 10
RoHe 0:d1ff330c5128 11 Last update by RoHe 16/11/2015
RoHe 0:d1ff330c5128 12
RoHe 0:d1ff330c5128 13 */
RoHe 0:d1ff330c5128 14
RoHe 0:d1ff330c5128 15 //#include "Ether.h"
RoHe 0:d1ff330c5128 16
RoHe 0:d1ff330c5128 17 /*
RoHe 0:d1ff330c5128 18 // Connect to Server
RoHe 0:d1ff330c5128 19 TCPSocketConnection socket;
RoHe 0:d1ff330c5128 20 while (socket.connect(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT) < 0) {
RoHe 0:d1ff330c5128 21 pc.printf("Unable to connect to (%s) on port (%d)\n\r", ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT);
RoHe 0:d1ff330c5128 22 wait(1);
RoHe 0:d1ff330c5128 23 }
RoHe 0:d1ff330c5128 24 pc.printf("Connected to Server at %s\n\r",ECHO_SERVER_ADDRESS);
RoHe 0:d1ff330c5128 25
RoHe 0:d1ff330c5128 26 // Send message to server
RoHe 0:d1ff330c5128 27 char hello[] = "Hello World";
RoHe 0:d1ff330c5128 28 pc.printf("Sending message to Server : '%s' \n\r",hello);
RoHe 0:d1ff330c5128 29 socket.send_all(hello, sizeof(hello) - 1);
RoHe 0:d1ff330c5128 30
RoHe 0:d1ff330c5128 31 // Receive message from server
RoHe 0:d1ff330c5128 32 char buf[256];
RoHe 0:d1ff330c5128 33 int n = socket.receive(buf, 256);
RoHe 0:d1ff330c5128 34 buf[n] = '\0';
RoHe 0:d1ff330c5128 35 pc.printf("Received message from server: '%s'\n\r", buf);
RoHe 0:d1ff330c5128 36
RoHe 0:d1ff330c5128 37 // Clean up
RoHe 0:d1ff330c5128 38 socket.close();
RoHe 0:d1ff330c5128 39 eth.disconnect();
RoHe 0:d1ff330c5128 40 */