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: EthernetInterface mbed-rtos mbed-src
Fork of TestNetComm by
Revision 6:97573a8dce83, committed 2014-05-10
- Comitter:
- MalcolmNixon
- Date:
- Sat May 10 21:52:53 2014 +0000
- Parent:
- 5:18415c556f04
- Commit message:
- Simple demo showing a crash in EthernetInterface::init
Changed in this revision
--- a/main.cpp Sun May 04 14:11:44 2014 +0000
+++ b/main.cpp Sat May 10 21:52:53 2014 +0000
@@ -2,6 +2,8 @@
#include "Thread.h"
#include "mbed.h"
+Serial pc(USBTX, USBRX);
+
void led2ThreadProc(const void *param)
{
// Toggle LED2
@@ -26,23 +28,37 @@
int main(void)
{
- // Start LED toggle(s)
+ int nr;
+
+ // Start LED2 toggle
+ pc.printf("Starting LED 2 thread\r\n");
Thread led2(led2ThreadProc);
+ osDelay(1000);
+
+ // Start LED3 toggle
+ pc.printf("Starting LED 3 thread\r\n");
Thread led3(led3ThreadProc);
+ osDelay(1000);
- // Start the network
- EthernetInterface::init("192.168.5.100", "255.255.255.0", "0.0.0.0");
- EthernetInterface::connect();
+ // Initialize the network
+ pc.printf("Initializing network\r\n");
+ nr = EthernetInterface::init("192.168.100.5", "255.255.255.0", "0.0.0.0");
+ pc.printf(" Network Init: %d\r\n", nr);
+
+ // Connect to the network
+ pc.printf("Connecting to the network\r\n");
+ nr = EthernetInterface::connect();
+ pc.printf(" Connected: %d\r\n", nr);
// Construct the server
TCPSocketServer svr;
svr.bind(1234);
svr.listen();
- TCPSocketConnection conn;
for (;;)
{
// Accept the next connection
+ TCPSocketConnection conn;
svr.accept(conn);
// Manage the connection
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-src.lib Sat May 10 21:52:53 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-src/#e752b4ee7de1
--- a/mbed.bld Sun May 04 14:11:44 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file
