ethernet

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of TCPSocket_HelloWorld by mbed official

main.cpp

Committer:
MohamadNazrin
Date:
2018-02-21
Revision:
16:65255e25e5dc
Parent:
15:bc7fc13dc5f6

File content as of revision 16:65255e25e5dc:

#include "mbed.h"
#include "EthernetInterface.h"
#include "C12832_lcd.h" // Include for LCD code

C12832_LCD lcd; //Initialize LCD Screen

int main() {
    
static const char*          mbedIp       = "192.168.137.2";  //IP
static const char*          mbedMask     = "255.255.255.0";  // Mask
static const char*          mbedGateway  = "192.168.137.1";    //Gateway

    EthernetInterface eth;
 //   eth.init(); //Use DHCP
 eth.init(mbedIp,mbedMask,mbedGateway); 
    eth.connect();
    printf("IP Address is %s\n", eth.getIPAddress()); // display at terminal
    lcd.printf("IP address: %s \n",eth.getIPAddress()); // display LCD screen

    while(1) {}
}