vhgr

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of sisk_project by Szymon Guza

Revision:
0:7a4b0e7660ad
Child:
1:65cfd74a3ae5
diff -r 000000000000 -r 7a4b0e7660ad main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 02 07:48:20 2016 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+
+int main() {
+
+    EthernetInterface eth;
+    eth.init(); //Use DHCP
+    eth.connect();
+    
+    while(1) {
+        if((int)phy_link_status()){
+            printf("Cable is connected\n");
+            if((int)phy_get_duplex())
+                printf("Full duplex\n");
+            else
+                printf("Half duplex\n");
+            if((int)phy_get_speed())
+                printf("100 Mbit per second\n");
+            else
+                printf("10 Mbit per second\n");
+            }
+        else
+            printf("Cable is disconnected\n");
+        
+
+        //printf("Connection status %d\n", (int)phy_link_status());
+        //printf("Duplex status %d\n", (int)phy_get_duplex());
+        //printf("Speed status %d\n", (int)phy_get_speed());
+        wait(5);
+        }
+}
\ No newline at end of file