Permalink
Browse files

oscon: WIP

  • Loading branch information...
1 parent 664a6b3 commit fee1b0a17b0e49e2298adc515410777f0dadbdea @jadonk committed Jul 18, 2012
Showing with 43 additions and 3 deletions.
  1. +3 −0 bone101/client.css
  2. +1 −0 bone101/client.js
  3. +23 −3 bone101/index.html
  4. +16 −0 fade.js
View
@@ -0,0 +1,3 @@
+#slider1 { margin: 10px; width: 50% }
+
+#slider2 { margin: 10px; width: 50% }
View
@@ -57,6 +57,7 @@ var clearPin = function(pinname) {
var initClient = function() {
$("#slider1").slider();
+ $("#slider2").slider();
try {
var canvas = document.getElementById("canvas1");
View
@@ -174,7 +174,7 @@ <h2 style="margin-left: 1em;">Simplified Physical Computing with Node.JS</h2>
</div>
<div class="slide">
- <h1>analogRead/analogWrite<h1>
+ <h1>analogRead/analogWrite</h1>
<h2>Use ADCs and PWMs to read/write analog values</h2>
<p>Monitor analog in: <span class="dynlink" onclick="eval(document.getElementById('analogWrite2').innerHTML)">
run</span></p>
@@ -202,8 +202,8 @@ <h2 style="margin-left: 1em;">Simplified Physical Computing with Node.JS</h2>
</div>
<div class="slide">
- <h1>analogRead/analogWrite<h1>
- <h2>Use ADCs and PWMs to read/write analog values</h2>
+ <h1>Using a slider with analogWrite</h1>
+ <h2>&nbsp;</h2>
<p>Please connect P8-13 to LED through 1khom resistor</p>
<div id="slider1"></div>
<p>Attach to slider: <span class="dynlink" onclick="eval(document.getElementById('analogWrite1').innerHTML)">
@@ -216,6 +216,26 @@ <h2 style="margin-left: 1em;">Simplified Physical Computing with Node.JS</h2>
</div>
<div class="slide">
+ <h1>Using a slider with analogRead</h1>
+ <h2>&nbsp;</h2>
+ <p>Please connect P9-36 to potentiometer and adust from 0V to 1.8V</p>
+ <div id="slider2"></div>
+ <p>Attach to slider: <span class="dynlink" onclick="eval(document.getElementById('analogRead1').innerHTML)">
+ run</span></p>
+ <pre id="analogRead1">
+arUpdateSlider = function(x) {
+ if(x.callback) $("#slider2").slider("option", "value", x.callback*100);
+};
+addLoop(function() {
+ return(analogRead(bone.P9_36));
+}, 100, arUpdateSlider);</pre>
+ <p>Halt all loops: <span class="dynlink" onclick="eval(document.getElementById('analogRead2').innerHTML)">
+ run</span></p>
+ <pre id="analogRead2">
+ getLoops(function(loops){for(var loop in loops.loops){removeLoop(loop, doAlert);}});</pre>
+ </div>
+
+ <div class="slide">
<h1>Cloud9 experience<h1>
</div>
View
@@ -0,0 +1,16 @@
+require('bonescript');
+
+awValue = 0.01;
+awDirection = 1;
+fade = function() {
+ analogWrite(bone.P8_13, awValue);
+ awValue = awValue + (awDirection*0.01);
+ if(awValue > 1.0) { awValue = 1.0; awDirection = -1; }
+ else if(awValue <= 0.01) { awValue = 0.01; awDirection = 1; }
+};
+
+setup = function() {
+ pinMode(bone.P8_13, 'out', 4);
+ setInterval(fade, 10);
+};
+

0 comments on commit fee1b0a

Please sign in to comment.