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: EthernetNetIf TextLCD mbed
Revision 1:cb49bd07d33d, committed 2011-10-04
- Comitter:
- sunifu
- Date:
- Tue Oct 04 13:29:48 2011 +0000
- Parent:
- 0:b75f48b4f752
- Commit message:
Changed in this revision
| TextLCD.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b75f48b4f752 -r cb49bd07d33d TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Oct 04 13:29:48 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r b75f48b4f752 -r cb49bd07d33d main.cpp
--- a/main.cpp Sun Oct 10 10:59:30 2010 +0000
+++ b/main.cpp Tue Oct 04 13:29:48 2011 +0000
@@ -1,10 +1,12 @@
#include "mbed.h"
#include "EthernetNetIf.h"
#include "TCPSocket.h"
+#include "TextLCD.h"
#define TCP_LISTENING_PORT 50505
BusOut myleds(LED1, LED2, LED3, LED4);
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
void onTCPSocketEvent(TCPSocketEvent e) ;
void onConnectedTCPSocketEvent(TCPSocketEvent e) ;
@@ -16,17 +18,33 @@
Host client ;
int main() {
-
- printf("Setting up...\r\n");
- EthernetErr ethErr = eth.setup();
+ lcd.locate(0,0);
+ lcd.printf("Setting up...");
+ EthernetNetIf eth; //(1)
+ //EthernetNetIf eth( // (2) -- static IP address
+ // IpAddr(192,168,0,6), // IP Address
+ // IpAddr(255,255,255,0), // Subnet Mask
+ // IpAddr(192,168,0,1), // Default Gateway
+ // IpAddr(192,168,0,1) // DNS Server
+ //) ;
+
+ EthernetErr ethErr = eth.setup();
if( ethErr != ETH_OK )
{
+ lcd.locate(0,0);
printf("Error %d in setup.\r\n", ethErr);
+ lcd.printf("NW Setup Error!", ethErr);
return -1;
}
+ lcd.locate(0,0);
+ lcd.printf("Setup OK ");
printf("Setup OK\r\n");
IpAddr ip = eth.getIp() ;
+
+ lcd.locate(0,1);
+ lcd.printf("%d.%d.%d.%d",ip[0],ip[1],ip[2],ip[3]);
+
printf("mbed IP Address is [%d.%d.%d.%d]\r\n", ip[0], ip[1], ip[2], ip[3]) ;
tcpSock.setOnEvent(&onTCPSocketEvent) ;