annotate service/garageArduino/index.html @ 408:0787cd64ecf8

cmdline flag on piNode to pick hub host Ignore-this: e88b7bc860b040e6952ddf3723f26a23
author drewp@bigasterisk.com
date Tue, 12 Mar 2019 00:14:12 -0700
parents a442bc778862
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
1 <?xml version="1.0" encoding="iso-8859-1"?>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
4 <html xmlns="http://www.w3.org/1999/xhtml">
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
5 <head>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
6 <title>garageArduino</title>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
7 <link rel="alternate" type="application/x-trig" title="RDF graph" href="graph" />
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
8 <style type="text/css" media="all">
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
9 /* <![CDATA[ */
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
10 .val {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
11 font-weight: bold;
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
12 }
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
13 .colorpicker {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
14 display: inline-block;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
15 }
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
16 /* ]]> */
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
17 </style>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
18 </head>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
19 <body>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
20
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
21 <h1>garageArduino service</h1>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
22
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
23 <p>Talking to an arduino uno on host <tt>slash</tt></p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
24
5
4c44c80a6a72 move garage door opener from parport to arduino
drewp@bigasterisk.com
parents: 4
diff changeset
25 <p>Pulse pin 3 to trigger garage door opener <form method="post" action="garageDoorOpen"><input type="submit" value="Garage door opener"/></form></p>
4c44c80a6a72 move garage door opener from parport to arduino
drewp@bigasterisk.com
parents: 4
diff changeset
26
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
27 <p><a href="http://octopart.com/555-28027-parallax-708653">PIR sensor</a> (in <a href="http://octopart.com/1551ggy-hammond-15686">a box</a>) measuring front door motion: <span class="val" id="frontDoorMotion"/></p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
28
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
29 <p><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;productId=2006414&amp;catalogId=10001&amp;freeText=2006414&amp;app.products.maxperpage=15&amp;storeId=10001&amp;search_type=jamecoall&amp;ddkey=http:StoreCatalogDrillDownView">phototransistor</a> watching IR pulses on the power meter: last pulse was <span class="val" id="lastPulseAgo"/>; current power usage is <span class="val"><span id="currentWatts"/> watts</span> (assuming <span class="val" id="kwhPerBlink"/> kwh/blink)</p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
30
4
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
31 <p>Recent raw IR sensor data: <div><img src="" id="raw"/></div></p>
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
32
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
33 <p><button type="submit" id="refresh">refresh</button></p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
34
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
35 <p>Bathroom LEDs</p>
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
36 <div><input id="lockColor" type="checkbox"/> Send first color to all LEDs</div>
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
37 <div class="colorpicker" id="p0"></div>
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
38 <div class="colorpicker" id="p1"></div>
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
39 <div class="colorpicker" id="p2"></div>
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
40 <div class="colorpicker" id="p3"></div>
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
41
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
42 <script type="text/javascript" src="//bigasterisk.com/lib/jquery-2.0.3.min.js"/>
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
43 <script type="text/javascript" src="//bigasterisk.com/lib/farbtastic-1.2/farbtastic.js"></script>
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
44 <link rel="stylesheet" href="//bigasterisk.com/lib/farbtastic-1.2/farbtastic.css" type="text/css" />
4
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
45
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
46 <script type="text/javascript">
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
47 // <![CDATA[
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
48 $(function () {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
49 function setTexts(data) {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
50 $.each(data, function (k,v) { $("#"+k).text(v); })
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
51 }
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
52 function refresh() {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
53 $.getJSON("frontDoorMotion", setTexts);
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
54 $.getJSON("housePower", setTexts);
4
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
55
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
56 $.getJSON("housePower/raw", function (data) {
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
57 var xp=[], yp=[];
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
58 var start = data.irLevels[0][0];
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
59 var maxTime = 0;
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
60 $.each(data.irLevels, function (i, xy) {
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
61 maxTime = xy[0] - start;
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
62 xp.push(maxTime.toPrecision(3));
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
63 yp.push(xy[1]);
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
64 });
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
65 // edit with http://imagecharteditor.appspot.com/
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
66 $("#raw").attr("src",
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
67 "http://chart.apis.google.com/chart"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
68 "?chxr=0,0,"+maxTime+"|1,0,1024"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
69 "&chds=0,"+maxTime+",0,1024"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
70 "&chxl=2:|seconds"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
71 "&chxs=0,676767,11.5,0,lt,676767|1,676767,11.5,-0.5,l,676767"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
72 "&chxt=x,y,x"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
73 "&chs=600x200"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
74 "&cht=lxy"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
75 "&chco=76A4FB"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
76 "&chd=t:"+xp.join(",")+"|"+yp.join(",")+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
77 "&chg=10,20"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
78 "&chls=2"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
79 "&chma=40,20,20,30"+
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
80 "&chm=h,FF0000,0,0.7:50:2,1");
be855a111619 move a bunch of services into this tree, give them all web status pages
drewp@bigasterisk.com
parents: 0
diff changeset
81 });
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
82 }
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
83 refresh();
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
84 $("#refresh").click(refresh);
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
85
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
86 var inProgress = false;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
87 var pending = {}; // url : data
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
88 function sendColor(url, newColor) {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
89 inProgress = 1;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
90 $.ajax({
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
91 type: "put", url: url,
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
92 contentType: "text/plain", data: newColor,
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
93 success: function () {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
94 inProgress = false;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
95 $.each(pending, function (u, n) {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
96 delete pending[u];
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
97 sendColor(u, n);
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
98 });
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
99 }
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
100 });
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
101 }
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
102 function copyColor(newColor) {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
103 $.farbtastic("#p1").setColor(newColor);
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
104 $.farbtastic("#p2").setColor(newColor);
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
105 $.farbtastic("#p3").setColor(newColor);
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
106 }
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
107 $("#lockColor").click(function () { copyColor($.farbtastic("#p0").color); });
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
108 $.each([
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
109 ["#p0", "brite/0"],
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
110 ["#p1", "brite/1"],
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
111 ["#p2", "brite/2"],
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
112 ["#p3", "brite/3"],
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
113 ], function (i, row) {
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
114 var picker = $.farbtastic(row[0], function (newColor) {
124
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
115 if (row[1] == "brite/0" && $("#lockColor")[0].checked) {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
116 copyColor(newColor);
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
117 }
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
118 if (inProgress) {
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
119 pending[row[1]] = newColor;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
120 return;
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
121 }
a442bc778862 fix up garagearduino web ui color pickers
drewp@bigasterisk.com
parents: 34
diff changeset
122 sendColor(row[1], newColor);
34
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
123 });
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
124 $.get(row[1], picker.setColor);
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
125 });
90ff65ccd46b garage: videoselect and shiftbrite move from parallel to arduino
drewp@bigasterisk.com
parents: 5
diff changeset
126
0
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
127 });
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
128 // ]]>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
129 </script>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
130 </body>
5
4c44c80a6a72 move garage door opener from parport to arduino
drewp@bigasterisk.com
parents: 4
diff changeset
131 </html>