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 Controle_ventilo_ethernet_v1_2_4 by
Diff: main.cpp
- Revision:
- 4:fb63da7601aa
- Parent:
- 3:6c54aa6db861
- Child:
- 5:cee119979b55
--- a/main.cpp Fri Jan 20 17:54:22 2017 +0000 +++ b/main.cpp Fri Apr 21 17:30:06 2017 +0000 @@ -11,11 +11,11 @@ #include <string.h> //using namespace std; -const char* ECHO_SERVER_ADDRESS = "192.168.0.146"; // addresse du PC home "192.168.1.2" sergio "169.254.61.104" or "129.194.185.33" or "255.255.252.0" liotard "10.136.134.73" +const char* ECHO_SERVER_ADDRESS = "192.168.137.1"; // addresse du PC home "192.168.1.2" sergio "169.254.61.104" or "129.194.185.33" or "192.168.137.1" liotard "10.136.134.73" //#define IP "10.136.134.100" //#define GATEWAY "10.136.132.1" //"129.194.184.1" //#define MASK "255.255.252.0" -const int ECHO_SERVER_PORT = 1025; +const int ECHO_SERVER_PORT = 1036; // Front fans //PwmOut frontFans[] = {(PB_11), (PE_14), (PE_9), (PB_3), (PB_15), (PB_6), (PB_13), (PE_5), (PC_8)}; // PE_11 also possible for front fan n°5 @@ -72,8 +72,32 @@ fantest = 0; wait(1); + bool ack = 0; //wait(10); + while(ack == 0){ + char out_buffer[256]; + snprintf(out_buffer, sizeof(out_buffer), "%s", eth.get_mac_address()); + sock.sendto(echo_server, out_buffer, sizeof(out_buffer)); + + //printf("%s\n", out_buffer); + + sock.set_timeout(1000); + + char in_buffer[256]; + int n = sock.recvfrom(&echo_server, in_buffer, sizeof(in_buffer)); + in_buffer[n] = '\0'; + + printf("%s\n", in_buffer); + + if(in_buffer == "got you"){ + ack = 1; + sock.set_timeout(-1); + } + } + + //printf(out_buffer); + while(1){ char out_buffer[] = "Envoyez moi une vitesse plz !"; printf("Sending message '%s' to server (%s)\n",out_buffer,ECHO_SERVER_ADDRESS);