kinkersnick

02-08-2011, 08:20 PM

Hi,

I'm using the Wiimote through Osculator into Processing with the OSCp5 library. Can get acceleromoter and IR information through no problem - and had lots of fun playing - but have just tried to route a button press through and it doesn't seem to be working. On quickview in Osculator, I can see that the button works - produces a value of either 1.0 or 0.0 as one would expect, but I can't seem to bring that information into Processing properly - what am I doing wrong?!

Here is the code:

import processing.opengl.*;

import oscP5.*;

import netP5.*;

float x;

float y;

OscP5 osc;

void setup() {

size(400, 400, OPENGL);

osc = new OscP5(this,9000);

osc.plug(this,"pry","/wii/1/accel/pry");

osc.plug(this,"pitch","/wii/1/accel/pry/0");

osc.plug(this, "ir1", "/wii/1/ir/xys/1");

osc.plug(this, "ir2", "/wii/1/ir/xys/2");

osc.plug(this, "trigg", "/wii/1/button/B");

background(255);

smooth();

fill(0);

stroke(0);

}

float pitch;

float roll;

float yaw;

float ir1x;

float ir1y;

float ir1s;

float ir2x;

float ir2y;

float ir2s;

float triggon;

void pry(float _pitch, float _roll, float _yaw, float _accel) {

pitch = _pitch;

roll = _roll;

yaw = _yaw;

}

void ir1(float _ir1x, float _ir1y, float _ir1s) {

ir1x = _ir1x

ir1y = _ir1y;

ir1s = _ir1s;

}

void ir2(float _ir2x, float _ir2y, float _ir2s) {

ir2x = _ir2x;

ir2y = _ir2y;

ir2s = _ir2s;

}

void trigg(float _triggon) {

triggon = _triggon;

}

void draw() {

background(255);

float realX = map(ir1x, 0.0, 1.0, 1.0, 0.0);

x = realX*width;

y = ir1y*width;

if(triggon == 1.0) {

fill(0);

} else {

fill(127);

}

ellipse(x, y, 30, 30);

}

I'm using the Wiimote through Osculator into Processing with the OSCp5 library. Can get acceleromoter and IR information through no problem - and had lots of fun playing - but have just tried to route a button press through and it doesn't seem to be working. On quickview in Osculator, I can see that the button works - produces a value of either 1.0 or 0.0 as one would expect, but I can't seem to bring that information into Processing properly - what am I doing wrong?!

Here is the code:

import processing.opengl.*;

import oscP5.*;

import netP5.*;

float x;

float y;

OscP5 osc;

void setup() {

size(400, 400, OPENGL);

osc = new OscP5(this,9000);

osc.plug(this,"pry","/wii/1/accel/pry");

osc.plug(this,"pitch","/wii/1/accel/pry/0");

osc.plug(this, "ir1", "/wii/1/ir/xys/1");

osc.plug(this, "ir2", "/wii/1/ir/xys/2");

osc.plug(this, "trigg", "/wii/1/button/B");

background(255);

smooth();

fill(0);

stroke(0);

}

float pitch;

float roll;

float yaw;

float ir1x;

float ir1y;

float ir1s;

float ir2x;

float ir2y;

float ir2s;

float triggon;

void pry(float _pitch, float _roll, float _yaw, float _accel) {

pitch = _pitch;

roll = _roll;

yaw = _yaw;

}

void ir1(float _ir1x, float _ir1y, float _ir1s) {

ir1x = _ir1x

ir1y = _ir1y;

ir1s = _ir1s;

}

void ir2(float _ir2x, float _ir2y, float _ir2s) {

ir2x = _ir2x;

ir2y = _ir2y;

ir2s = _ir2s;

}

void trigg(float _triggon) {

triggon = _triggon;

}

void draw() {

background(255);

float realX = map(ir1x, 0.0, 1.0, 1.0, 0.0);

x = realX*width;

y = ir1y*width;

if(triggon == 1.0) {

fill(0);

} else {

fill(127);

}

ellipse(x, y, 30, 30);

}