Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
johnschimmel / 3RelaySerial.ino
Last active Aug 29, 2015
3 Relays + Serial input
View 3RelaySerial.ino
/*
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 Aug 29, 2015
MeSpeak JS integration with custom youtube makeymakey player
View makeyspeak2.html
<!-- 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 Aug 29, 2015
Ardunio + Hbridge motor control
View motorcontrol.ino
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);
View websocketserver.py
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'
View websocketserver.py
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'
@johnschimmel
johnschimmel / serial_read_integers.ino
Created Sep 28, 2014
Serial reading in multiple bytes and integer values
View serial_read_integers.ino
/*
http://www.baldengineer.com/blog/2012/07/30/arduino-multi-digit-integers/
*/
unsigned int controllerInputVal=0; // Max value is 65535
char incomingByte;
char controllerInput;
void setup()
{
View joyrelay.ino
/*
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 Feb 7, 2011
Titanium Facebook Graph Session
View gist:814485
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 Jun 8, 2011
nodejs dual tcp server to pass data between ports
View nodeDualTcp.js
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 Jul 28, 2011
Arduino accessory switch for Steven/PS3
View accessorySwitch.pde
/*
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