GSR Reader

Galvanic skin response readings are simply the measurement of electrical resistance through the body. Two leads are attached to two fingertips. One lead sends current while the other measures the difference. This setup measures GSR every 50 milliseconds. Each reading is graphed, while peaks are highlighted and an average is calculated to smooth out the values. A baseline reading is taken for 10 seconds if the readings go flat (fingers removed from leads).

Infinite Mouse Tracking

I wanted to use the mouse as a simple surface optical encoder to get infinite panning motion. The problem with reading mouse coordinates on the screen, is that once the mouse reaches the edge of the screen, it stops counting. So a simple solution is to reposition the mouse (using the robot class) every few frames and calculate the change in mouse positions.


//InfiniteMouseTracking
//by Che-Wei Wang
//2.20.2008

float mapPositionX;
float mapPositionY;
long count=0;
int moveX=0;
int moveY=0;

void setup() 
{
  size(screen.width,screen.height,P3D);
  mapPositionX=width/2;
  mapPositionY=height/2;

  //noCursor();
  
  //set the mouse postion once before the program begins
  try {
    Robot robot = new Robot();
    robot.mouseMove(width/2, height/2);    
  } 
  catch (AWTException e) {
  }

}

void draw()
{
  background(0);

  //reset the cursor Position every few frames
  if(count%4==0){
    try {
      Robot robot = new Robot();
      robot.mouseMove(width/2, height/2);    
    } 
    catch (AWTException e) {
    }
    moveX=mouseX-pmouseX;
    moveY=mouseY-pmouseY;
  }

  count++;

  //new position= old position + movement * decay
  mapPositionX=mapPositionX+moveX*.8;
  mapPositionY=mapPositionY+moveY*.8;

  stroke(255);
  line(width/2,height/2,mapPositionX,mapPositionY);
  ellipse(mapPositionX,mapPositionY,100,100);

}

Sensors Galore

An example of blobDetection, Ess, sms, and ocd all rolled into one sketch. Click and drag on the screen to move the HUD sliders around. (nothing is going to load here. copy the code to your processing sketch to run it)