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: CR2 EthernetInterface FreescaleIAP I2CLCD SerialDriver jro k64f_EthLink mbed-rtos mbed
Diff: test_eth.cpp
- Revision:
- 0:53494cfddea7
diff -r 000000000000 -r 53494cfddea7 test_eth.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test_eth.cpp Thu Jul 21 14:57:44 2016 +0000
@@ -0,0 +1,39 @@
+#if 0
+
+#include "mbed.h"
+#include "rtos.h"
+#include "EthernetInterface.h"
+
+RawSerial pc(USBTX, USBRX);
+EthernetInterface eth;
+
+#define IP_INI "10.10.50.85"; // IP
+#define MASK_INI "255.255.255.0"; // MASK
+#define GATEWAY_INI "10.10.50.1"; // GATEWAY
+const char* IP = IP_INI; // IP
+const char* MASK = MASK_INI; // MASK
+const char* GATEWAY = GATEWAY_INI; // GATEWAY
+
+int main(){
+ pc.printf("Initializing network interface...\r\n");
+ if (0 == eth.init(IP, MASK, GATEWAY)) {
+ // It should always take this path
+ do {
+ pc.printf("Connecting to network...\r\n");
+ if (0 == eth.connect()) {
+ pc.printf("Ethernet connected as %s\r\n", eth.getIPAddress());
+ Thread::wait(5000);
+ pc.printf("lost connection.\r\n");
+ eth.disconnect();
+ }
+ else {
+ pc.printf(" ... failed to connect.\r\n");
+ }
+ } while (1);
+ }
+ else {
+ pc.printf(" ... failed to initialize, rebooting...\r\n");
+ }
+}
+
+#endif
\ No newline at end of file
