vhgr

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of sisk_project by Szymon Guza

main.cpp

Committer:
guzbi
Date:
2016-12-02
Revision:
0:7a4b0e7660ad
Child:
1:65cfd74a3ae5

File content as of revision 0:7a4b0e7660ad:

#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);
        }
}