TeamE7

Dependencies:   EthernetInterface HTTPServer RemoteIR SDFileSystem mbed-rpc mbed-rtos mbed

Fork of SmartRemote by Sam Kirsch

HTTPServerHelloWorld.cpp

Committer:
donatien
Date:
2010-06-14
Revision:
0:5630d7e58a0b

File content as of revision 0:5630d7e58a0b:

#include "mbed.h"
#include "EthernetNetIf.h"
#include "HTTPServer.h"

EthernetNetIf eth;  
HTTPServer svr;

DigitalOut led1(LED1);

int main() {
  printf("Setting up...\n");
  EthernetErr ethErr = eth.setup();
  if(ethErr)
  {
    printf("Error %d in setup.\n", ethErr);
    return -1;
  }
  printf("Setup OK\n");
  
  svr.addHandler<SimpleHandler>("/"); //Default handler
  svr.bind(80);
  
  printf("Listening...\n");
    
  Timer tm;
  tm.start();
  //Listen indefinitely
  while(true)
  {
    Net::poll();
    if(tm.read()>.5)
    {
      led1=!led1; //Show that we are alive
      tm.start();
    }
  }
  
  return 0;
}