Skip to content

Instantly share code, notes, and snippets.

@aaronsherwood
aaronsherwood / Tambleep
Created September 30, 2012 22:23
contact mic bleep sketch for arduino's tone function
const int sensorPin = A0;
int sensorValue = 0;
int fundamental = 55;
int psv, frequency;
boolean ready = 0;
void setup() {
Serial.begin(9600);
}
@aaronsherwood
aaronsherwood / Robospiel-hello world version
Created October 2, 2012 04:59
bang a lollipop on a glockenspiel with arduino
#include <Servo.h>
Servo servoMotor;
const int servoPin=2;
void setup(){
servoMotor.attach(servoPin);
}
void loop(){
@aaronsherwood
aaronsherwood / Guitar Strings as Switch
Created October 10, 2012 07:10
an arduino turns the strings of an acoustic guitar into switches, and then triggers video in max mapped to the fret board of a guitar in mad mapper
const int guitarString1 = 2;
const int guitarString2 = 3;
const int guitarString3 = 4;
const int guitarString4 = 5;
const int guitarString5 = 6;
const int guitarString6 = 7;
void setup() {
pinMode(guitarString1, INPUT);
@aaronsherwood
aaronsherwood / glockentarArduino
Created November 23, 2012 17:51
Arduino code for the Glockentar
const int guitarPin[8] = {A0, A1, A2, A3, A4, A5, 2, 3};
const int solenoidPin[8] = {5, 6, 7, 8, 9, 10, 11, 12};
int switchState[8] = {0, 0, 0, 0, 0, 0, 0, 0};
boolean triggered[8] = {0, 0, 0, 0, 0, 0, 0, 0};
void setup() {
for (int i=0; i<8; i++) {
pinMode(guitarPin[i], INPUT);
pinMode(solenoidPin[i], OUTPUT);
digitalWrite(solenoidPin[i],HIGH);
@aaronsherwood
aaronsherwood / ofGlockentar
Created November 23, 2012 17:56
openFrameworks code for the Glockentar
#include "testApp.h"
const int width =320;
const int height = 240;
int interval [8];
bool trigger [8];
float counter [8];
int rectSpot [8];
float triggerCounter [8];
int inByte;
@aaronsherwood
aaronsherwood / PicSlice
Created December 6, 2012 18:53
Picture slicing and brightness sorting of those pictures in processing.
// this is where the picture gets sliced up, measured for brightness, and stored in the PicSlice object
slices=new PImage[width];
for (int x=0;x<width;x++) {
slices[x]=createImage(1, height, RGB);
slices[x].loadPixels();
for (int y=0;y<height; y++) {
color colorSlice=img2.get(x, y);
slices[x].pixels[y]=colorSlice;
}
@aaronsherwood
aaronsherwood / UPC
Created December 6, 2012 18:59
UPC encoding in processing to make bar codes.
class Upc {
int upcCode[];
String a, b, c, d, e, f, g, h, i, j, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj;
String output []= { "1 0 1"};
int outBits[]=new int[95];
Upc(int code[]){
this.upcCode=code;
}
@aaronsherwood
aaronsherwood / redial_helloworld
Created February 4, 2013 23:25
dial tones for charlie parker's kim:
exten => s,1,Playtones(349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,440/90,523/30,666/30,440/30,349+440/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,349/90,587/30,523/30,466/30,466+587/250,440/90,523/30,666/30,440/30,349+440/250,4
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
video.loadMovie("bridgeR.mov");
video.play();
ofBackground(0);
ofEnableAlphaBlending();
image.allocate(video.getWidth(), video.getHeight(), OF_IMAGE_COLOR);
mode=1;
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();