A tiny webserver alowing to remotely turn on or turn off a digital output on an STM32F407VET6 board. For more details see https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/
Dependencies: EthernetInterface mbed-rtos mbed
Turn LED1, or other digital output, on/off using a web browser.
In this example we create a HTTP server that will serve a simple Web page to remotely turn LED1, or other digital output, on/off by using a web browser.
Notice that DHCP is turned on by default. The IP address assigned to the WebSwitch server along with an instruction how to use it is printed to the connected PC's serial terminal window during program start up.
For more details on how to connect an Ethernet interface to a STM32F407VET6 board see https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/.
The project was inspired by the Tuxgraphics Web Switch. Thank you Guido!
Revision 1:a583ba376cc7, committed 2018-04-03
- Comitter:
- hudakz
- Date:
- Tue Apr 03 08:58:14 2018 +0000
- Parent:
- 0:7764029ff97d
- Commit message:
- Updated.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7764029ff97d -r a583ba376cc7 main.cpp --- a/main.cpp Mon Apr 02 19:37:18 2018 +0000 +++ b/main.cpp Tue Apr 03 08:58:14 2018 +0000 @@ -20,8 +20,8 @@ TCPSocketConnection client; bool clientIsConnected = false; -const int OFF = 0; -const int ON = 1; +const int OFF = 1; +const int ON = 0; DigitalOut sw(PA_6); float roomTemp = 21.8; // A temperature sensor output @@ -163,7 +163,7 @@ * @retval */ int main(void) { - + sw = OFF; //setup ethernet interface ethernet.init(); //Use DHCP //ethernet.init("192.168.1.181", "255.255.255.0", "192.168.1.1"); // Use static IP