TeamE7

Dependencies:   EthernetInterface HTTPServer RemoteIR SDFileSystem mbed-rpc mbed-rtos mbed

Fork of SmartRemote by Sam Kirsch

Revision:
16:2d23297857bc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SupportingFiles/remote.htm.txt	Wed Dec 04 17:44:29 2013 +0000
@@ -0,0 +1,59 @@
+<html>
+    <head>
+        <title>Smart Remote</title>
+        <script src="mbedRPC.js" type="text/javascript" language="javascript"></script>
+        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
+        <script type="text/javascript">
+            mbed = new HTTPRPC();
+            
+            RPCRequest = new RPCVariable(mbed, "Request"); 
+            RPCLearn = new RPCVariable(mbed, "Learn");
+            RPCName0 = new RPCVariable(mbed, "Learn_name0");
+            RPCName1 = new RPCVariable(mbed, "Learn_name1");
+            RPCName2 = new RPCVariable(mbed, "Learn_name2");
+            RPCName3 = new RPCVariable(mbed, "Learn_name3");
+            RPCName4 = new RPCVariable(mbed, "Learn_name4");
+            RPCName5 = new RPCVariable(mbed, "Learn_name5");
+            RPCName6 = new RPCVariable(mbed, "Learn_name6");
+            RPCName7 = new RPCVariable(mbed, "Learn_name7");
+            RPCName8 = new RPCVariable(mbed, "Learn_name8");
+            RPCName9 = new RPCVariable(mbed, "Learn_name9");
+            
+            function send_id(clicked_id) 
+            {
+                RPCRequest.write(clicked_id);
+            }
+            
+            function learner()
+            {
+                RPCLearn.write(1);
+                a = document.getElementById("button_name").value;
+                if( a.length > 10) { alert("Button name cannot exceed 10 characters!"); document.getElementById("button_name").value = "";}
+                a = a.split('');
+                for (i = 0; i < 10; i++) {
+                    if (a[i] == undefined)
+                    a[i] = '~';
+                }
+                for (i = 0; i < 10; i++) {
+                    var x = eval("RPCName" + i);
+                    x.write(a[i]);
+                }           
+            }
+        </script>
+        <script>
+            $.get('/sd/SmartRemote/db.txt', function(data) {
+            //$('#text').append(data);
+            data = data.split("\n");    
+            for (d in data) {
+                if(d%5 == 1) // Grab all the button names (every third entry)
+                    $('#text').append("<button id="+data[d-1]+" onClick=\"send_id(this.id)\">" + data[d] + "</button>"); //set id's
+            }
+            });
+        </script>
+    </head>
+    <body>
+        <button id="learn" onClick="learner()">Learn</button><input type="text" id="button_name" />
+        <div id="text"></div>
+        
+    </body>
+</html>
\ No newline at end of file