Skip to content

Instantly share code, notes, and snippets.

View jrmedd's full-sized avatar

James Medd jrmedd

View GitHub Profile
# Tweeting Letterbox
# by James Medd
# November 2012 (original version)
# http://jamesmedd.co.uk/
#!/usr/bin/python
import picamera
import RPi.GPIO as GPIO
import sys
#include "DigiKeyboard.h"
int tilt = 0;
int leftUp = 1;
int rightDown = 2;
void setup() {
pinMode(tilt, INPUT);
pinMode(leftUp, INPUT);
pinMode(rightDown, INPUT);
@jrmedd
jrmedd / LatestArduinoIDE.cpp
Last active May 16, 2020 10:50
Replace '#include "WProgram.h"' with this code to make libraries compatible with latest Arduino IDE.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
/*Replace #include "WProgram.h" with the above code to make compatible with
latest Arduino IDE.*/
@jrmedd
jrmedd / Mega_Drive_PS3.ino
Created May 4, 2013 08:54
Use Mega Drive pad on PS3. Requires Unojoy (http://code.google.com/p/unojoy/) A = Circle B = Cross C = Square Start + Up = Home Button Start + Down = Select
#include "UnoJoy.h"
int up = 2;
int down = 3;
int left = 4;
int right = 5;
int ab = 6;
int slct = 7; //setting this pin HIGH/LOW reads A/B and Start/C
int startc = 8;
Verifying that +jamesmedd is my blockchain ID. https://onename.com/jamesmedd
/*
LOAD THIS SCRIPT AFTER THE MAIN TWINE ENGINE
*/
function keySelectOption(inputs) {
for (var i=0; i<inputs.length; i++) {
document.onkeydown = function(e) {
var option = document.activeElement;
if (e.keyCode==40) {
var node = option.nextSibling;
while (node) {
@jrmedd
jrmedd / awkward_arduino_fastest_finger.ino
Last active November 29, 2018 01:00
Code for Awkward Arduino workshop – fastest finger.
/*
AWKWARD ARDUINO – FASTEST FINGER
*/
/*
We're going to connect LEDs to pins 3, 4, and 5.
These will act as winning lightts for the green
and blue team, and the red light that tells you
when to press!
*/
setTimeout(function() {
var internalLinks = document.getElementsByClassName('internalLink');
for (var i = 0; i < internalLinks.length; i ++) {
internalLinks[i].href = "#";
}
internalLinks[0].focus();
var target = document.getElementById("passages");
var observer = new MutationObserver(function(mutations) {
console.log("Change");
setTimeout(function() {
//wait a second and select the first tw-link on the page
jQuery(document).ready(function() {
setTimeout(function(){jQuery('tw-expression tw-link:first').focus()}, 1000);
});
//select tw-story node
var target = document.getElementsByTagName("tw-story")[0];
// create an observer instance, get it to execute a function whenever tw-story changes (i.e. when the user interacts)
var observer = new MutationObserver(function(mutations) {