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.
Dependencies: EthernetInterface mbed-rtos mbed
Fork of FRDM_K64F-Ethernet by
Revision 1:f4d12640cd54, committed 2015-09-29
- Comitter:
- elpellini
- Date:
- Tue Sep 29 14:50:45 2015 +0000
- Parent:
- 0:bbc9cfdee3bc
- Commit message:
- Teste de publica??o
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 22 02:34:12 2014 +0000
+++ b/main.cpp Tue Sep 29 14:50:45 2015 +0000
@@ -1,29 +1,32 @@
#include "mbed.h"
#include "EthernetInterface.h"
-#define MBED_DEV_IP "192.168.0.52"
-#define MBED_DEV_MASK "255.255.255.0"
-#define MBED_DEV_GW "0.0.0.0"
+#define MBED_DEV_IP "172.16.3.100"
+#define MBED_DEV_MASK "255.255.0.0"
+#define MBED_DEV_GW "172.16.0.254"
#define ECHO_SERVER_PORT 5000
+Serial PC(USBTX,USBRX);
int main (void) {
EthernetInterface eth;
+ PC.baud(9600);
+ PC.printf("K64F is alive!!!\r\n");
eth.init(MBED_DEV_IP, MBED_DEV_MASK, MBED_DEV_GW); //Assign a device ip, mask and gateway
eth.connect();
- printf("IP Address is %s\n", eth.getIPAddress());
+ PC.printf("IP Address is %s\r\n", eth.getIPAddress());
TCPSocketServer server;
server.bind(ECHO_SERVER_PORT);
server.listen();
while (true) {
- printf("\nWait for new connection...\n");
+ PC.printf("Wait for new connection...\r\n");
TCPSocketConnection client;
server.accept(client);
- client.set_blocking(false, 1500); // Timeout after (1.5)s
+ client.set_blocking(false, 5000); // Timeout after (5)s
- printf("Connection from: %s\n", client.get_address());
+ PC.printf("Connection from: %s\r\n", client.get_address());
char buffer[256];
while (true) {
int n = client.receive(buffer, sizeof(buffer));
