ethernet

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of TCPSocket_HelloWorld by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EthernetInterface.h"
00003 #include "C12832_lcd.h" // Include for LCD code
00004 
00005 C12832_LCD lcd; //Initialize LCD Screen
00006 
00007 int main() {
00008     
00009 static const char*          mbedIp       = "192.168.137.2";  //IP
00010 static const char*          mbedMask     = "255.255.255.0";  // Mask
00011 static const char*          mbedGateway  = "192.168.137.1";    //Gateway
00012 
00013     EthernetInterface eth;
00014  //   eth.init(); //Use DHCP
00015  eth.init(mbedIp,mbedMask,mbedGateway); 
00016     eth.connect();
00017     printf("IP Address is %s\n", eth.getIPAddress()); // display at terminal
00018     lcd.printf("IP address: %s \n",eth.getIPAddress()); // display LCD screen
00019 
00020     while(1) {}
00021 }