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.
Diff: main.cpp
- Revision:
- 7:59a37ccd06ef
- Parent:
- 6:11edc8f9d870
- Child:
- 8:e500ff7ddcaf
--- a/main.cpp Mon Nov 23 13:07:58 2020 +0000 +++ b/main.cpp Mon Nov 23 13:28:40 2020 +0000 @@ -4,13 +4,8 @@ *********************************** * Round trip delay meter. This is the "echo" module. * A microcontroller board with an Ethernet interface. -<<<<<<< working copy * An other microcontroller with "Round Trip Delay" will be needed. * ST NUCLEO H743ZI2 used for testing. -======= - * An other microcontroller with "Round trip echo" will be needed. - * NXP FRDM-K64F used for testing. ->>>>>>> merge rev * * Timo Karppinen 23.11.2020 ***********************************/ @@ -31,24 +26,16 @@ // UDP uint8_t ip[4] = {192, 168, 1, 104}; -SocketAddress clientUDP(ip, NSAPI_IPv4); -//SocketAddress clientUDP(strIP); // Client on remote device -//SocketAddress clientUDP; +SocketAddress clientUDP(ip, NSAPI_IPv4); // The remote device UDPSocket serverUDP; // UDP server in this device - - // Functions void udpReceive( void ); void udpSend( void ); -<<<<<<< working copy DigitalIn sw2(PC_13); // Blue button on H743ZI, button pressed = TRUE DigitalOut led2(PE_1); // Yellow LED on H743ZI -======= -DigitalIn sw2(SW2); // sw2 on K64F, button pressed = FALSE -DigitalOut led2(LED2); // RGB LED green on K64F ->>>>>>> merge rev + int sw2state = 0; int sw2old = 1; @@ -63,12 +50,9 @@ Timer armedFor; int main() { -<<<<<<< working copy + printf("\nEcho for the Round Trip Delay application (using Ethernet)\r\n"); -======= - printf("\nRound trip delay in UDP messaging (using Ethernet)\n"); ->>>>>>> merge rev - + //Bring up the network interface net.connect(); @@ -87,16 +71,11 @@ recv_thread.start(udpReceive); printf("Listening has been started at port number %d\n", LOCAL_PORT); - - - - send_thread.start(udpSend); printf("Sending out \"Echo\" data to port number %d", REMOTE_PORT); printf(" will be armed for triggering by pushing Blue button.\n"); printf("The IP is taken from the incoming message \n"); - while(1) { sw2state = sw2.read(); printf( "\nsw2state is %d\n", sw2state); @@ -123,10 +102,8 @@ in_data[k] = 0; } } - newDatagramOld = newDatagram; //Sending the "Echo" once only. - + newDatagramOld = newDatagram; //Sending the "Echo" once only. } - } newDatagram = 0; sw2old = sw2state; // Once only with pushing the button as long as you like. @@ -141,7 +118,6 @@ // The functions - void udpReceive() { int bytes; @@ -153,10 +129,7 @@ printf("string: %s\n",in_data); printf("client address: %s\n", clientUDP.get_ip_address()); printf("\n"); -<<<<<<< working copy -======= - ->>>>>>> merge rev + } }