Mercurial > code > home > repos > homeauto
annotate service/garageArduino/index.html @ 810:44e1ca03ddf1
move garage door opener from parport to arduino
Ignore-this: c7d21f40841af0e64b26dd4991e441ae
darcs-hash:20110815044657-312f9-4533ff085af323016f0c7a51629b250231ef2dc6.gz
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 14 Aug 2011 21:46:57 -0700 |
parents | bebb8f7c5a3e |
children | 90ff65ccd46b |
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 | |
32 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"/> | |
809
bebb8f7c5a3e
move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
805
diff
changeset
|
33 |
bebb8f7c5a3e
move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
805
diff
changeset
|
34 |
805 | 35 <script type="text/javascript"> |
36 // <![CDATA[ | |
37 $(function () { | |
38 function setTexts(data) { | |
39 $.each(data, function (k,v) { $("#"+k).text(v); }) | |
40 } | |
41 function refresh() { | |
42 $.getJSON("frontDoorMotion", setTexts); | |
43 $.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
|
44 |
bebb8f7c5a3e
move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
805
diff
changeset
|
45 $.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
|
46 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
|
47 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
|
48 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
|
49 $.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
|
50 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
|
51 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
|
52 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
|
53 }); |
bebb8f7c5a3e
move a bunch of services into this tree, give them all web status pages
drewp <drewp@bigasterisk.com>
parents:
805
diff
changeset
|
54 // 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
|
55 $("#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
|
56 "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
|
57 "?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
|
58 "&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
|
59 "&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
|
60 "&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
|
61 "&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
|
62 "&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
|
63 "&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
|
64 "&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
|
65 "&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
|
66 "&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
|
67 "&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
|
68 "&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
|
69 "&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
|
70 }); |
805 | 71 } |
72 refresh(); | |
73 $("#refresh").click(refresh); | |
74 }); | |
75 // ]]> | |
76 </script> | |
77 </body> | |
810
44e1ca03ddf1
move garage door opener from parport to arduino
drewp <drewp@bigasterisk.com>
parents:
809
diff
changeset
|
78 </html> |