Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
nataliefreed / TinkerableArray.pde
Last active August 29, 2015 13:56 — forked from anonymous/TinkerableArray.pde
Sketch for experimenting with image arrays in Processing.
int rows = 10;
int columns = 12;
int[] circles = new int[rows*columns];
int index;
int spacing = 50;
int circleSize = 6;
void setup()
{
@nataliefreed
nataliefreed / speedcontrol.ino
Last active August 29, 2015 13:56
Robotic arm speed control
/*
Robotic arm speed control demo
Natalie Freed, Jan 2014
*/
#include <Servo.h>
Servo base, shoulder, elbow, wrist, gripper;
@nataliefreed
nataliefreed / DraggableExample.pde
Last active August 29, 2015 13:57
Draggable objects and handler example for Processing 2.0 Natalie Freed, March 2014
/*
Draggable objects and handler example for Processing 2.0
Natalie Freed, March 2014
*/
DraggableHandler circles;
void setup()
{
size(500, 500);
@nataliefreed
nataliefreed / cp5buttonexample.pde
Created March 19, 2014 16:15
Adapted from ControlP5 Button Example by by Andreas Schlegel, 2012 from www.sojamo.de/libraries/controlp5
//Adapted from ControlP5 Button Example by by Andreas Schlegel, 2012
//www.sojamo.de/libraries/controlp5
import controlP5.*; //make sure ControlP5 library is installed for this line to work
ControlP5 cp5;
int myColor = color(255);
void setup() {
size(400,400);
@nataliefreed
nataliefreed / RGB_LilyPad_ProtoSnap.ino
Created April 4, 2014 02:28
RGB Color-Mixing LED example code for LilyPad ProtoSnap
//RGB Color-Mixing LED
//For LilyPad ProtoSnap
/*************************************
//Change the variables in this section
//Colors are between 0 and 255
//Times are in milliseconds. For eg., 1 second = 1000 milliseconds.
*************************************/
int colors[][3] = { {255, 150, 0}, {100, 0, 200}, {255, 0, 0}};
int times[] = { 5000, 1000, 500 };
int numberOfColors = 3;
//count pressed, turn from red to green by Natalie Freed
//April 2014
//with debounce code from David Mellis
int red = 9;
int blue = 10;
int green = 11;
int buttonPin = A5;
@nataliefreed
nataliefreed / StateMachineTimer.pde
Created May 6, 2014 13:13
State Machine Stopwatch Example (2 states)
ArrayList<RectangularButton> buttons = new ArrayList<RectangularButton>();
RectangularButton startButton;
boolean startClicked = false;
String currentState = "STOPPED";
boolean timerRunning = false;
int time = 0;
int timeStarted = millis();
int countInterval = 1000; //timer counts seconds
void setup()
@nataliefreed
nataliefreed / squareling.pde
Last active August 29, 2015 14:01
Stop Motion Creature
SquareCreature squareling;
float tblink, tbounce = 0;
int numSleepyImgs = 4;
PImage happyImg, blinkImg, angryImg, sleepyImg;
PImage[] sleepyImgs = new PImage[numSleepyImgs];
void setup()
{
imageMode(CENTER);
@nataliefreed
nataliefreed / code_generator.pde
Created May 8, 2014 17:42
Processing Code Generator / Drawing Tool
import controlP5.*;
ControlP5 cp5;
DraggableHandler circles;
ArrayList<Draggable> shapes;
int toolbarWidth = 75;
PVector toolbarLoc;
int codeMenuWidth = 300;
//Register key events in Processing 2.0
//Natalie Freed 2014
//References:http://processing.org/reference/javadoc/core/processing/event/KeyEvent.html
//http://forum.processing.org/one/topic/how-to-register-methods-in-processing-2b1.html
//http://wiki.processing.org/w/Register_events (1.0 way)
//circle changes color when 'c' key pressed, changes back when key released
KeyboardyCircle kc = new KeyboardyCircle(0, this);