Mercurial > code > home > repos > homeauto
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 |
rev | line source |
---|---|
805 | 1 <?xml version="1.0" encoding="iso-8859-1"?> |
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
4 <html xmlns="http://www.w3.org/1999/xhtml"> | |
5 <head> | |
6 <title>garageArduino</title> | |
7 <link rel="alternate" type="application/x-trig" title="RDF graph" href="graph" /> | |
8 <style type="text/css" media="all"> | |
9 /* <![CDATA[ */ | |
10 .val { | |
11 font-weight: bold; | |
12 } | |
13 /* ]]> */ | |
14 </style> | |
15 </head> | |
16 <body> | |
17 | |
18 <h1>garageArduino service</h1> | |
19 | |
20 <p>Talking to an arduino uno on host <tt>slash</tt></p> | |
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 | 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> |
25 | |
26 <p><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&productId=2006414&catalogId=10001&freeText=2006414&app.products.maxperpage=15&storeId=10001&search_type=jamecoall&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> | |
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 | 30 <p><button type="submit" id="refresh">refresh</button></p> |
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 | 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 | 39 <script type="text/javascript"> |
40 // <![CDATA[ | |
41 $(function () { | |
42 function setTexts(data) { | |
43 $.each(data, function (k,v) { $("#"+k).text(v); }) | |
44 } | |
45 function refresh() { | |
46 $.getJSON("frontDoorMotion", setTexts); | |
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 | 75 } |
76 refresh(); | |
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 | 91 }); |
92 // ]]> | |
93 </script> | |
94 </body> | |
810
44e1ca03ddf1
move garage door opener from parport to arduino
drewp <drewp@bigasterisk.com>
parents:
809
diff
changeset
|
95 </html> |