Skip to content

Instantly share code, notes, and snippets.

View Craigson's full-sized avatar

Craig Pickard Craigson

View GitHub Profile
@Craigson
Craigson / Andy_Kinect
Created July 15, 2015 16:12
Mapping kinect depth values to pixels
//The Kinect gives you depth data for every pixel in the image (which is a 640 x 480 image).
//These values are retreived using the depthMap() call.
//This code is operating on the assumption that you're using a grid of 64 x 48 servo
//motors for your "mirror", this way the aspect ratio is maintained.
import SimpleOpenNI.*;
SimpleOpenNI kinect;
int[] depthValues; //this will hold integer values for the depth data for each pixel
int[] indices; //we use this to store the converted values from the
@Craigson
Craigson / ATtiny_MLX_Sensor
Created September 10, 2015 21:02
Arduino sketch for contactless IR circuit using Melexis thermopile and ATtiny85.
//INCLUDE REQUIRED LIBRARIES
#include <Adafruit_NeoPixel.h>
#include <TinyWireM.h>
#include <Adafruit_MiniMLX90614.h>
#include <SoftwareSerial.h>
int TINY_SDA = 0; //ATtiny SDA pin 5
int TINY_SCL = 2; //ATtiny SCL pin 7
int LED_PIN = 1; //NEOPIXEL LED ON ATtuny PIN 6
int NUMPIXELS = 1; //THE NEOPIXEL LIBRARY NEEDS YOU TO PASS THE NUMBER OF PIXELS AS A FUNCTION ARGUMENT
@Craigson
Craigson / syringe_pump_interface.ino
Created October 9, 2015 19:13
Firmware for the syringe pump control interface
/*
* Stepper:
* coil A+ yellow
* coil A- red
* coil B+ grey
* coil B- green
*/
#define stp 2 //step pin
@Craigson
Craigson / shadows.html
Created October 13, 2015 05:13
Calculating shadows in the Fragment shader
<script src=lib1.js></script>
<body bgcolor=black>
<center>
<td><canvas id='canvas1' width=600 height=600></canvas></td>
</center>
</body>
<script id='my_vertex_shader' type='x-shader/x-vertex'>
attribute vec3 aPosition;
@Craigson
Craigson / stepper_test.ino
Created December 4, 2015 00:45
Stepper test code
#define stp 3
#define dir 4
#define MS1 5
#define MS2 6
#define EN 7
//Declare variables for functions
char user_input;
int x;
int y;
@Craigson
Craigson / gotblocker.js
Created December 7, 2015 04:31
testing GOTblocker
/*
TO DO:
- IF A DIV CONTAINS ANY WORDS RELATED TO GOT, SWAP THE IMAGE
- IF A SENTENCE CONTAINS ANY WORDS RELATING TO GOT, REDACT IT
*/
// Grab the entire document body
// This gets an array even though it's likely just one thing
@Craigson
Craigson / Day38App.cpp
Last active March 6, 2016 21:41
Phong lighting experiment
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/CameraUi.h"
#include "cinder/Utilities.h"
using namespace ci;
using namespace ci::app;
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Serial.h"
#include "cinder/Log.h"
#include <sstream>
#define BUFSIZE 80
#define READ_INTERVAL 0.25
@Craigson
Craigson / Test.cpp
Created April 8, 2016 12:02
Some test code for sending commands to the EBB
//Hi Brian
//I'm running into those same issues, hopefully you might be able to point out something basic I'm doing wrong.
//To give you an overview, during this testing phase I've created a container that will hold a list of the string commands I want to execute, it's called mCommandStack. Pressing any of the arrow keys pushes the corresponding command onto the stack.
//This is the code in my keyDown method:
case 273:
cout << "Moving up!" << endl;
@Craigson
Craigson / CSVrecorderApp.cpp
Last active April 9, 2016 00:15
The first app records Joint Data from a Kinect to into a CSV file, the second loads the data from the CSV and draws it to the screen
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "Kinect2.h"
#include <fstream>
#include <iostream>
using namespace ci;
using namespace ci::app;
using namespace std;