Skip to content

Instantly share code, notes, and snippets.

View mikestreety's full-sized avatar

Mike Street mikestreety

View GitHub Profile
@dugdaniels
dugdaniels / index.html
Created January 7, 2013 00:34
An example of a browser-based input for Johnny-Five. Clicking the button in index.html turns on and off an LED installed on the Arduino board.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready(function() {
var socket = io.connect('http://localhost');
$('#button').click(function(e){
socket.emit('click');
e.preventDefault();
//so before you had:
if(options.slide == 'up') { $(this).slideUp(time, options.callback);} // slide Up
else if(options.slide == 'down') { $(this).slideDown(time, options.callback);} // slide down
else if(options.slide == 'toggle') {$(this).slideToggle(time, options.callback);} // slide toggle
/**there's a pattern here
* if options.slide = up, call slideUp
* if it's down, call slideDown
* it it's toggle, call slideToggle