A remote timer, equipped with a scheduling Web interface, controls a "DigitalOut".

Dependencies:   Timezone NTPClient

WebTimer

The WebTimer is an Mbed device enabling to remotely control a DigitalOut. It has a "calendar-like" user interface to edit the schedule - a table you can click on (or tap on a touch-screen device).
The program was ported to Mbed from the Tuxgraphics site. Thank you Guido for sharing!

  • When starting, it will print it's IP address over the USB serial link to the terminal screen. However, you can set a different static IP address if you modify the code in the main.cpp.
  • To connect to the WebTimer, type the IP address into the web browser edit box and hit ENTER.
  • When a cell is green then the timer keeps it's output ON during that period of time. If a cell is not green it means the output is OFF.
  • To select or deselect multiple cells you can click (keep down the button) and move the mouse over more cells.
  • The smallest time interval on this 24h timer is 15minutes.
  • To save the changes type in the password and hit ENTER or click on the Save button.
  • The default password is "secret". But you can change it by editing the source code in main.cpp.
OnDesktopOnPhone

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Fri Nov 13 09:37:14 2020 +0000
Parent:
3:2862fe67dce0
Commit message:
A remote timer, equipped with a scheduling Web interface, controls a "DigitalOut".

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2862fe67dce0 -r fe9189193dcd main.cpp
--- a/main.cpp	Thu Nov 12 18:36:25 2020 +0000
+++ b/main.cpp	Fri Nov 13 09:37:14 2020 +0000
@@ -20,7 +20,7 @@
 #include "NTPClient.h"
 #include "Timezone.h"
 
-#define IP                 "192.168.1.181"
+#define IP                 "192.168.1.183"
 #define GATEWAY            "192.168.1.1"
 #define NETMASK            "255.255.255.0"
 #define PORT               80
@@ -325,7 +325,7 @@
         "<meta name=viewport content=\"width=device-width\">\n"
         "<a href=/sw>[Switch]</a> <a href=/sc>[Set clock]</a> <a href=/>[&#8635;Refresh]</a>\n"
     );
-    strcat(httpBuf, "<h2><pre>Watering Timer<br>");
+    strcat(httpBuf, "<h2><pre>24h Watering Timer<br>");
 
     strcat(httpBuf, "Output: ");
     if (relay == ON) {
@@ -630,13 +630,12 @@
     //net = NetworkInterface::get_default_instance();
     net = new EthernetInterface();
 
-    //net->set_network("192.168.1.181","255.255.255.0","192.168.1.1");  // use static IP address, netmask, gateway
+    net->set_network(IP,NETMASK,GATEWAY);   // uncomment to use static IP address, netmask, gateway
     if (!net) {
         printf("Error! No network inteface found.\n");
         return 0;
     }
 
-    //net->set_network (IP, NETMASK, GATEWAY);  // include this to use static IP address
     nsapi_size_or_error_t   r = net->connect();
     if (r != NSAPI_ERROR_OK) {
         printf("Error! net->connect() returned: %d\n", r);