Skip to content

Instantly share code, notes, and snippets.

View Craigson's full-sized avatar

Craig Pickard Craigson

View GitHub Profile
@Craigson
Craigson / gist:83f41471c694bf58206e
Created September 15, 2014 02:00
The Love-o-meter: Under pressure
//Love-o-meter: under pressure
//Craig Pickard
//this is an indicator level with 6 stages, the first stage has four levels
//with green LEDs, the highest two levels use red LEDs to indicate danger
const int levelOne = 5; //green LED
const int levelTwo = 6; //green LED
const int levelThree = 7; //green LED
const int levelFour = 8; //green LED
const int levelFive = 9; //green LED
@Craigson
Craigson / gist:aa3bfd061ce6d1043803
Created September 17, 2014 00:33
Simple dual-mode drawing program
//Craig Pickard
//ICM - Week 2: basic animation
//About this program:
/*
This program contains a button that switches between two modes,
there is a drawing mode, where a mousePressed event draws a
collection of circles (defined by random variables) around the mouse pointer.
clicking the button, and changing modes, spawns a collection of
randomly appearing variables. A mouseclick event enables the eraser,
which allows the user to erase the circles. The erasers brush size
//notes for later version:
//add shooting sounds & music
//add obstacles for the jet to dodge
//add explosions for hits
PImage img; // create image for jet
PImage imgTwo; //create image for clouds
Cloud[] clouds = new Cloud[5]; //an array of clouds
Bullet[] bullets = new Bullet[1]; //one bullet object
@Craigson
Craigson / gist:9b3845cb045fab86d0e6
Created September 30, 2014 15:21
Basic motion controller Processing sketch
import processing.serial.*; // import the Processing serial library
Serial myPort; // The serial port
float bgcolor; // Background color
float fgcolor; // Fill color
float xDegree, yDegree; // Starting position of the ball
boolean firstContact = false;
int buttonState;
// boolean button = false;
@Craigson
Craigson / gist:782d6bd26be01ef38b94
Created September 30, 2014 15:25
Serial Communication with Processing (ADXL335 Accelerometer)
const int buttonPin = 2;
void setup(){
Serial.begin(9600);
pinMode(buttonPin, INPUT);
establishContact();
}
//ICM - Week 4
//Craig Pickard, September 2014
//mathematical equations taken from
//the pendulum class is for the most part adapted from Daniel Shiffmans 2005 example,
//but has been updating using PVectors.
//the program begins with the angle to the vertical, for each pendulum,
//equal to zero. Manually drag any of the pendulums to the desired starting angle
@Craigson
Craigson / gist:6a9383b7829c4940d4a9
Created October 8, 2014 06:18
Pendulum Wave (updated with trails)
//ICM - Week 4
//Craig Pickard, September 2014
//mathematical equations taken from
//the pendulum class is for the most part adapted from Daniel Shiffmans 2005 example,
//but has been updating using PVectors.
//the program begins with the angle to the vertical, for each pendulum,
//equal to zero. Manually drag any of the pendulums to the desired starting angle
@Craigson
Craigson / gist:bc95b774e293e5c18b8f
Created October 8, 2014 22:25
Instagram multi button
import http.requests.*;
import processing.serial.*; //import serial library
Serial myPort; //declare a serial port
int buttonValue;
int previousButtonValue;
boolean receivingData = false;
int sensorvalue=0;
//create a boolean variable to establish whether or not the arduino
@Craigson
Craigson / gist:e2992d6569d87d64c630
Created October 8, 2014 22:26
Instagram Multi button (Arduino)
//P-comp midterm
//Instagram grid-button prototype
//5 October 2014
//Craig Pickard and Minju Viviana Kim
boolean checkButtons = false;
//assign variables for each grid tile
const int button1 = 2;
const int button2 = 3;
const int button3 = 4;
@Craigson
Craigson / gist:c8b2fbe1eaf34f7848df
Created October 11, 2014 23:32
IR gesture detector
//code based on Ricardo Uvina's instrucables project, found here: http://www.instructables.com/id/Simple-IR-proximity-sensor-with-Arduino/?ALLSTEPS
//P-Comp mid-term
//Craig Pickard and Minju Vivan Kim
//IR swipe detector
//11 October 2014
int IRpin = A0; // IR photodiode on analog pin A0
int IRemitter = 2; // IR emitter LED on digital pin 2
int thresholdLEDpin = 12; // red LED on digital pin 12.
int ambientIR; // variable to store the IR coming from the ambient