Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
johnschimmel / 3RelaySerial.ino
Last active August 29, 2015 14:01
3 Relays + Serial input
/*
Pins, 13-11 connected to relays
serial input 1-3 to toggle relay on for 2 seconds
from Tom Igoe's RGB Serial example
This example code is in the public domain.
*/
// pins for the LEDs:
const int pinA = 13;
@johnschimmel
johnschimmel / makeyspeak2.html
Last active August 29, 2015 14:02
MeSpeak JS integration with custom youtube makeymakey player
<!-- Copy this into your HTML file right aboove </body> -->
<!-- load jquery from cdn -->
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<!-- STEP 1 - load mespeak from your webserver UPDATE PATH. Download here http://www.masswerk.at/mespeak -->
<script type='text/javascript' src='http://www.productiondesign.nl/yt_player_mespeak/js/mespeak/mespeak.js'></script>
<script type='text/javascript'>
// STEP 2 - config mespeak you will need two files
@johnschimmel
johnschimmel / motorcontrol.ino
Last active August 29, 2015 14:03
Ardunio + Hbridge motor control
const int cloudModulePin = 2; // switch input from cloud module JST connector <-----> Arduino pin 2
const int motor1Pin = 6; // H-bridge pin 2 <-----> Arduino pin 6
const int motor2Pin = 7; // H-bridge pin 7 <-----> Arduino pin 7
// note - arduino and JST connector share common ground
void setup() {
// set the switch as an input:
pinMode(cloudModulePin, INPUT);
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int relay1 = 13; // pin 13
@johnschimmel
johnschimmel / gist:814485
Created February 7, 2011 14:59
Titanium Facebook Graph Session
Titanium.Facebook.sessionForAccessToken = function(callback) {
var app_id = '<APP_ID>';
var app_secret = '<APP_SECRET>';
xhr.onerror = function(e)
{
Ti.API.info('Unable to exchange session for OAuth access_token ' + e.error);
callback(false);
};
xhr.setTimeout(10000);
@johnschimmel
johnschimmel / nodeDualTcp.js
Created June 8, 2011 20:18
nodejs dual tcp server to pass data between ports
var net = require('net');
var guestsA = [];
var guestsB = [];
var serverA = net.createServer(function (socket) {
//socket.write("Echo server\r\n");
//socket.pipe(socket);
});
@johnschimmel
johnschimmel / accessorySwitch.pde
Created July 28, 2011 12:25
Arduino accessory switch for Steven/PS3
/*
Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.
The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
@johnschimmel
johnschimmel / arduino_basic_switch.pde
Created September 6, 2011 18:11
Switch into Arduino
// Detect a Switch
// Example to detect a switch press
// Developed for the Developing Assistive Technology class
int switchPin = 2;
int switchValue = 0;
int ledPin = 13;
int counter = 0;