Wii Remote button problem
in
Integration and Hardware
•
2 years ago
Hi,
Still very new to all this, so the answer may be very simple, but I'm stuck. I'm using a Wii remote through OSCulator into Processing with the OSCp5 library. Have managed to get the accelorometers and IR feeds working, but have just tried to bring in a button for the first time and it doesn't seem to be working.
I've inserted a line to print the value of whether or not the B button (trigger) is pressed or not in the console, but regardless of whether it's pressed or not, the printed value is always "0.0"
What am I doing wrong?
Thank you for any help!
Here is the code:
Still very new to all this, so the answer may be very simple, but I'm stuck. I'm using a Wii remote through OSCulator into Processing with the OSCp5 library. Have managed to get the accelorometers and IR feeds working, but have just tried to bring in a button for the first time and it doesn't seem to be working.
I've inserted a line to print the value of whether or not the B button (trigger) is pressed or not in the console, but regardless of whether it's pressed or not, the printed value is always "0.0"
What am I doing wrong?
Thank you for any help!
Here is the code:
- import processing.opengl.*;
import oscP5.*;
import netP5.*;
OscP5 osc;
void setup() {
size(800, 800, 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();
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);
fill(0);
float ir1xC = map(ir1x, 0, 1, 1, 0);
ellipse(ir1xC*width, ir1y*width, 30, 30);
println(triggOn);
}
1