@@ -163,14 +163,29 @@ <h2>The recipe</h2>
163163</ section >
164164
165165< section >
166- < h2 > Hardware</ h2 >
166+ < h2 > Hardware: Raspberry Pi </ h2 >
167167 < img src ="img/adafruit-pi-kit.jpg " style ="max-height: 500px ">
168168 < p > From: < a href ="http://www.adafruit.com/products/1014 "> adafruit.com/products/1014</ a > </ p >
169169</ section >
170170
171+ < section >
172+ < h2 > Hardware: Arduino Uno</ h2 >
173+ < img src ="img/Arduino316.jpg " style ="max-height: 500px ">
174+ </ section >
175+
176+ < section >
177+ < h2 > Hardware Prep: Flash Firmata</ h2 >
178+ < img src ="img/flash-firmata.gif " style ="max-height: 500px ">
179+ </ section >
180+
181+ < section >
182+ < h2 > Wire stuff up</ h2 >
183+ < img src ="img/l5-led.png " style ="max-height: 500px ">
184+ </ section >
185+
171186< section >
172187 < h2 > Wire stuff up</ h2 >
173- < img src ="img/rpi-led-blink .png " style ="max-height: 500px ">
188+ < img src ="img/j5-button .png " style ="max-height: 500px ">
174189</ section >
175190
176191< section >
@@ -187,25 +202,49 @@ <h2>Johnny-Five</h2>
187202Install Johnny-Five
188203< pre > < code data-trim >
189204$ npm install johnny-five
190- $ npm install raspi-io
191205</ code > </ pre >
192206< div class ="fragment ">
193207Paste in some code< br />
194208< pre > < code data-trim >
195- var raspi = require('raspi-io');
196209var five = require('johnny-five');
197210
198- var board = new five.Board({ io: new raspi() } );
211+ var board = new five.Board();
199212
200213board.on('ready', function() {
201- var led = new five.Led("P1-7 ");
202- led.blink(500 );
214+ var led = new five.Led("13 ");
215+ led.on( );
203216});
204217</ code > </ pre >
205218 </ div >
206- < p class ="fragment "> From < a href ="http ://github.com/bryan-m-hughes/raspi-io / "> github.com/bryan-m-hughes/raspi-io /</ a > </ p >
219+ < p class ="fragment "> From < a href ="https ://github.com/rwaldron/johnny-five / "> https:// github.com/rwaldron/johnny-five /</ a > </ p >
207220</ section >
208221
222+ < section >
223+ < h2 > Johnny-Five</ h2 >
224+
225+ Add button code< br />
226+ < pre > < code data-trim >
227+ var five = require('johnny-five');
228+
229+ var board = new five.Board();
230+
231+ board.on('ready', function() {
232+ var led = new five.Led("13");
233+ var button = new five.Button("8");
234+
235+ button.on("up", function () {
236+ led.off();
237+ });
238+
239+ button.on("down", function () {
240+ led.on();
241+ });
242+ });
243+ </ code > </ pre >
244+ < p class ="fragment "> From < a href ="https://github.com/rwaldron/johnny-five/ "> https://github.com/rwaldron/johnny-five/</ a > </ p >
245+
246+ </ section >
247+
209248< section >
210249 Hardware done. < br />
211250 Driver done.< br />
@@ -240,29 +279,30 @@ <h3>Firebase Realtime Database</h3>
240279</ section >
241280
242281< section >
243- < h2 > Realtime is</ h2 >
244-
245- < h3 > Where your bus is</ h3 >
282+ < h3 > Realtime is where your bus is</ h3 >
283+ < a href ="https://wherebus.firebaseapp.com "> https://wherebus.firebaseapp.com</ a >
284+ < br />
285+ < br />
246286
247- < div id =" map-canvas " style ="width: 100%; height: 600px "> </ div >
287+ < iframe src =" https://wherebus.firebaseapp.com/ " style ="width: 100%; max- height: 100%; height: 600px "> </ iframe >
248288</ section >
249289
250290< section >
251- < h2 > Realtime is</ h2 >
252291
253- < h3 > Collaborative drawing</ h3 >
292+ < h3 > Realtime is collaborative drawing</ h3 >
293+ < a href ="https://yaay.firebaseapp.com "> https://yaay.firebaseapp.com</ a >
294+ < br />
295+ < br />
254296
255- < iframe style =" background-color: #fff; overflow: hidden; " scrolling =" no "
256- src =" https://yaay.firebaseapp.com/#-JsZFzbs0dbYGQkxA_yh " width =" 800 " height =" 400 "> </ iframe >
297+ < iframe scrolling =" no " src =" https://yaay.firebaseapp.com/#default "
298+ style =" background-color: #fff; overflow: hidden; width: 800px; height: 400px "> </ iframe >
257299
258- < br /> < a href ="http://tinyurl.com/DrawYay "> http://tinyurl.com/DrawYay</ a >
259300</ section >
260301
261302
262303< section >
263304 < h2 > Realtime game state</ h2 >
264- < iframe style =" margin-top: -50px; background-color: #fff; overflow: hidden; -webkit-transform: scale(0.7); "
265- src ="https://mmoasteroids.firebaseapp.com " width ="1300 " height ="600 " scrolling ="no "> </ iframe >
305+ < img src ="img/mmo-asteroids.gif ">
266306
267307 < br /> < a href ="http://mmoasteroids.firebaseapp.com "> http://mmoasteroids.firebaseapp.com</ a >
268308</ section >
@@ -296,21 +336,24 @@ <h4>Read Data</h4>
296336 < h2 > Put it all together</ h2 >
297337 < br />
298338< pre > < code data-trim >
299- var board = new five.Board({ io: new raspi() });
300- var firebase =
301- new Firebase("https://ioext.firebaseio.com/button");
302-
303- board.on("ready", function() {
304- var led = new five.Led("P1-7");
305- var button = new five.Button("P1-13");
306-
307- button.on("down", function () { firebase.set(true); });
308- button.on("up", function () { firebase.set(false); });
309-
310- firebase.on("value", function(snap) {
311- if(snap.val()) { led.on();
312- } else { led.off(); }
313- };});</ code > </ pre >
339+ var five = require('johnny-five');
340+ var Firebase = require("firebase");
341+ var board = new five.Board();
342+ var firebaseRef = new Firebase("https://firebutton.firebaseio-demo.com/button");
343+
344+ board.on("ready", function () {
345+ var button = new five.Button(8);
346+ var led = new five.Led(13);
347+ button.on("up", function () { firebaseRef.set(false); });
348+ button.on("down", function () { firebaseRef.set(true); });
349+
350+ firebaseRef.on("value", function (snapshot) {
351+ var buttonValue = snapshot.val();
352+ if (buttonValue) {
353+ led.on();
354+ setTimeout(function() { led.off(); }, 2500); }
355+ });});
356+ </ code > </ pre >
314357
315358</ section >
316359
@@ -323,7 +366,7 @@ <h2>Demos</h2>
323366 var ref = new Firebase ( "https://firebutton.firebaseio-demo.com/button" ) ;
324367 ref . on ( "value" , function ( snapshot ) {
325368 var buttonValue = snapshot . val ( ) ;
326- if ( buttonValue && currentSlide == 18 ) {
369+ if ( buttonValue && currentSlide == 23 ) {
327370 $ ( '#player' ) . tubeplayer ( {
328371 initialVideo : "dQw4w9WgXcQ" ,
329372 autoPlay : true
@@ -338,7 +381,9 @@ <h2>Demos</h2>
338381< section >
339382 < h2 > Now go build cool stuff</ h2 >
340383 Slides: < a href ="https://mimming.com/presos/internet-of-nodebots "> mimming.com/presos/internet-of-nodebots</ a > < br />
341- Code: < a href ="https://github.com/mimming/internet-of-nodebots "> github.com/mimming/internet-of-nodebots</ a > < br /> < br />
384+ Slide code: < a href ="https://github.com/mimming/internet-of-nodebots "> github.com/mimming/internet-of-nodebots</ a > < br /> < br />
385+ FireButton Code: < a href ="https://github.com/mimming/firebutton "> github.com/mimming/firebutton</ a > < br /> < br />
386+ < br />
342387 Me: < a href ="https://twitter.com/MimmingCodes "> @MimmingCodes</ a >
343388</ section >
344389
@@ -389,14 +434,6 @@ <h2>Now go build cool stuff</h2>
389434 ]
390435 } ) ;
391436
392- // Update to display map on map-canvas when that slide loads
393- Reveal . addEventListener ( 'slidechanged' , function ( event ) {
394- if ( event . indexh === 14 ) {
395- transitmapstart ( )
396- }
397- } ) ;
398-
399- // Update to display map on map-canvas when that slide loads
400437 Reveal . addEventListener ( 'slidechanged' , function ( event ) {
401438 currentSlide = event . indexh ;
402439 } ) ;
0 commit comments