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!
Diff: main.cpp
- Revision:
- 1:a583ba376cc7
- Parent:
- 0:7764029ff97d
--- 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