Hey! I was able to get this code to work on two computers, but it's not working at all when I try to run the sketch independent of the browser on my tablet. I'm wondering if this has something to do with the port number or android mode?
Here is the code on my tablet:
import oscP5.*;
import netP5.*;
Buttons button1;
Buttons button2;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(600,800);
frameRate(25);
/* start oscP5, listening for incoming messages at port 12000 */
oscP5 = new OscP5(this,12000);
myRemoteLocation = new NetAddress("192.168.1.179",12000);
button1 = new Buttons();
button1.x = 100;
button1.y = 100;
button1.w = 100;
button1.h = 100;
button2 = new Buttons();
button2.x = 250;
button2.y = 100;
button2.w = 100;
button2.h = 100;
}
void draw() {
background(0);
rectMode(CENTER);
fill(squareColor, 0, 0);
button1.display("hello");
button2.display("fractured");
}
void mousePressed() {
button1.clicked("hello");
button2.clicked("testing");
}
void clicked(String wordMessage){
float d = dist(x, y, mouseX, mouseY);
if (d < 50) {
boxBackground = 255;
OscMessage myMessage = new OscMessage(wordMessage);
oscP5.send(myMessage, myRemoteLocation);
println(myMessage);
}
Here is the code on my computer:
import oscP5.*;
import netP5.*;
int circleColor = 200;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400,400);
frameRate(25);
oscP5 = new OscP5(this,12000);
myRemoteLocation = new NetAddress("192.168.1.128",12000);
}
void draw() {
background(0);
rectMode(CENTER);
fill(circleColor, 0, 0);
ellipse(width/2, height/2, 100, 100);
}
void oscEvent(OscMessage theOscMessage) {
print("### received an osc message.");
//print(" addrpattern: "+theOscMessage.addrPattern());
println(" typetag: "+theOscMessage.typetag());
if(theOscMessage.checkAddrPattern("poopin")==true) {
println("it worked!");
} else if (theOscMessage.checkAddrPattern("hello")==true) {
println("yay, it worked!");
}
}