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.
main.cpp
00001 #include "mbed.h" 00002 #include "HTTPServer.h" 00003 #include "HTTPFS.h" 00004 #include "HTTPWebSocketHandler.h" 00005 #include "HTTPRestHandler.h" 00006 00007 DigitalIn maskSense(p10); 00008 00009 HTTPServer httpd ( 00010 "mBed", // hostname 00011 IPv4(192,168,maskSense?42:24,42), // IP address 00012 IPv4(255,255,255,0), // Netmask 00013 IPv4(192,168,maskSense?42:24,1), // Gateway 00014 IPv4(192,168,maskSense?42:24,1), // DNS 00015 80 // Port 00016 ); 00017 00018 LocalFileSystem local("local"); 00019 DigitalOut led1(LED1); 00020 TemperatureSensor sensor; 00021 RGBLed rgb; 00022 00023 int main() { 00024 httpd.addHandler(new HTTPWebSocketHandler("/ws")); 00025 httpd.addHandler(new HTTPRestHandler("/io")); 00026 httpd.addHandler(new HTTPFileSystemHandler("/", "/local/")); 00027 httpd.bind(); 00028 00029 Timer tm; 00030 tm.start(); 00031 printf("Listening...\n"); 00032 while (1) { 00033 httpd.poll(); 00034 if (tm.read()>.5) { 00035 led1=!led1; //Show that we are alive 00036 tm.start(); 00037 } 00038 } 00039 }
Generated on Wed Jul 13 2022 23:42:34 by
1.7.2