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
Fork of HTTP_server by
main.cpp
- Committer:
- pabloxid
- Date:
- 2013-07-26
- Revision:
- 1:f0c641cd9bad
- Parent:
- 0:fcceff3299be
- Child:
- 4:2a34139c7246
File content as of revision 1:f0c641cd9bad:
#include "mbed.h"
#include "EthernetInterface.h"
#include "HTTPServer.h"
LocalFileSystem local("local");
DigitalOut led1(LED1);
void http_thread (void const* arg);                   //
int main() {
   
    EthernetInterface eth;
    eth.init(); //Use DHCP
    eth.connect();
    printf("IP Address is %s\n", eth.getIPAddress());
    
    Timer onesec;
    onesec.start();
    Thread httpsvr( &http_thread );
    while (true) {
        if (onesec.read() > 1) {
            onesec.reset();
            led1 = 1-led1;
        }
        
    }
    
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                            HTTP THREAD                                           //
//////////////////////////////////////////////////////////////////////////////////////////////////////
void http_thread (void const* arg) {
    HTTPServer svr (80, "/local/");    // esto incluye el init
    // osThreadSetPriority( Thread::gettid() ,  osPriorityBelowNormal );
    while (1) {
        svr.poll();
    }
}
            
    