annotate service/garageArduino/index.html @ 839:9cf01cee74f6

garage: videoselect and shiftbrite move from parallel to arduino Ignore-this: 45c791caa87d4c054826020eeae8298b darcs-hash:20120625075033-312f9-fe2b5088e638e008dd194bd450aa1bac3d48c233.gz
author drewp <drewp@bigasterisk.com>
date Mon, 25 Jun 2012 00:50:33 -0700
parents 44e1ca03ddf1
children a442bc778862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
805
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 }
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
13 /* ]]> */
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
14 </style>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
15 </head>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
16 <body>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
17
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
18 <h1>garageArduino service</h1>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
19
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
20 <p>Talking to an arduino uno on host <tt>slash</tt></p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
21
810
44e1ca03ddf1 move garage door opener from parport to arduino
drewp <drewp@bigasterisk.com>
parents: 809
diff changeset
22 <p>Pulse pin 3 to trigger garage door opener <form method="post" action="garageDoorOpen"><input type="submit" value="Garage door opener"/></form></p>
44e1ca03ddf1 move garage door opener from parport to arduino
drewp <drewp@bigasterisk.com>
parents: 809
diff changeset
23
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
24 <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
25
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
26 <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
27
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
28 <p>Recent raw IR sensor data: <div><img src="" id="raw"/></div></p>
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
29
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
30 <p><button type="submit" id="refresh">refresh</button></p>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
31
839
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
32 <p>Bathroom shiftbrite</p>
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
33 <div class="colorpicker" id="p0"></div>
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
34
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
35 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"/>
839
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
36 <script type="text/javascript" src="http://bigasterisk.com/bathroomLight/static/farbtastic/farbtastic.js"></script>
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
37 <link rel="stylesheet" href="http://bigasterisk.com/bathroomLight/static/farbtastic/farbtastic.css" type="text/css" />
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
38
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
39 <script type="text/javascript">
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
40 // <![CDATA[
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
41 $(function () {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
42 function setTexts(data) {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
43 $.each(data, function (k,v) { $("#"+k).text(v); })
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
44 }
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
45 function refresh() {
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
46 $.getJSON("frontDoorMotion", setTexts);
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
47 $.getJSON("housePower", setTexts);
809
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
48
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
49 $.getJSON("housePower/raw", function (data) {
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
50 var xp=[], yp=[];
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
51 var start = data.irLevels[0][0];
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
52 var maxTime = 0;
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
53 $.each(data.irLevels, function (i, xy) {
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
54 maxTime = xy[0] - start;
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
55 xp.push(maxTime.toPrecision(3));
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
56 yp.push(xy[1]);
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
57 });
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
58 // edit with http://imagecharteditor.appspot.com/
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
59 $("#raw").attr("src",
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
60 "http://chart.apis.google.com/chart"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
61 "?chxr=0,0,"+maxTime+"|1,0,1024"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
62 "&chds=0,"+maxTime+",0,1024"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
63 "&chxl=2:|seconds"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
64 "&chxs=0,676767,11.5,0,lt,676767|1,676767,11.5,-0.5,l,676767"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
65 "&chxt=x,y,x"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
66 "&chs=600x200"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
67 "&cht=lxy"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
68 "&chco=76A4FB"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
69 "&chd=t:"+xp.join(",")+"|"+yp.join(",")+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
70 "&chg=10,20"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
71 "&chls=2"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
72 "&chma=40,20,20,30"+
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
73 "&chm=h,FF0000,0,0.7:50:2,1");
bebb8f7c5a3e move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents: 805
diff changeset
74 });
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
75 }
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
76 refresh();
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
77 $("#refresh").click(refresh);
839
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
78
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
79 $.each([
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
80 ["#p0", "brite/0"],
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
81 ], function (i, row) {
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
82 var picker = $.farbtastic(row[0], function (newColor) {
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
83 $.ajax({
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
84 type: "put", url: row[1],
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
85 contentType: "text/plain", data: newColor
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
86 });
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
87 });
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
88 $.get(row[1], picker.setColor);
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
89 });
9cf01cee74f6 garage: videoselect and shiftbrite move from parallel to arduino
drewp <drewp@bigasterisk.com>
parents: 810
diff changeset
90
805
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
91 });
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
92 // ]]>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
93 </script>
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
94 </body>
810
44e1ca03ddf1 move garage door opener from parport to arduino
drewp <drewp@bigasterisk.com>
parents: 809
diff changeset
95 </html>